![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| the printf command | bebop1111116 | Shell Programming and Scripting | 4 | 10-01-2006 12:40 AM |
| printf command in ksh | cin2000 | Shell Programming and Scripting | 1 | 12-21-2005 02:48 PM |
| find: problems escaping printf-command string | grahamb | Shell Programming and Scripting | 1 | 12-04-2005 04:00 PM |
| need help with printf command | nymus7 | Shell Programming and Scripting | 1 | 04-21-2005 07:05 PM |
| printf command | FIRE | Shell Programming and Scripting | 2 | 08-07-2002 02:18 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
||||
|
@ Annihilannic
Input Text File as follows Statistics,: ,Fri ,Sep ,26 ,00:00:01 ,2008 First ,Interrogation Incoming,= ,243 ,Outgoing,= 243 ThroughPut,= ,24.28,(requests/sec) Average ,response ,time,= ,2.47,(ms) ,MIN,= ,1.31,(ms) ,MAX,= ,5.11,(ms) ,No. ,measurements,= ,214, Intermediate ,Interrogation Incoming,= ,13 ,Outgoing,= ,13 ThroughPut,= ,1.30,(requests/sec) Average ,response ,time,= ,3.19,(ms) ,MIN,= ,2.44,(ms) ,MAX,= ,4.15,(ms) ,No. ,measurements,= ,13, Final ,Report Incoming,= ,158 ,Outgoing,= ,157 ThroughPut,= ,15.69,(requests/sec) Average ,response ,time,= ,2.34,(ms) ,MIN,= ,1.53,(ms) ,MAX,= ,3.57,(ms) ,No. ,measurements, I want this result. a CSV file see below 00:00:01,24.28,1.30,15.69 Could you give me UNIX expression to do this please. |
|
||||
|
awk would be useful for pulling out that information. Try this:
Code:
awk -F' *, *' '
# Print a line feed if we hit a new record and it is not the first one
/^Statistics/ && NR>1 { print "" }
# Print the timestamp, with no line feed after it
/^Statistics/ { printf $6 }
# Print a comma followed by the throughput, with no line feed
/^ThroughPut/ { printf ","$3 }
# Print a line feed at the end of the data
END { print "" }
' inputfile > outputfile
|
|
||||
|
@ Annihilannic
See printout below. the AWK command does not seem to work for this file. Any ideas. Tnx Statistics : Fri Nov 28 00:00:04 2008 Total ThroughPut = 46.76 (requests/sec) First Interrogation Incoming = 292 Outgoing = 292 ThroughPut = 29.17 (requests/sec) Average response time = 2.72 (ms) MIN = 0.72 (ms) MAX = 58.04 (ms) No. measurements = 247 Intermediate Interrogation Incoming = 27 Outgoing = 27 ThroughPut = 2.70 (requests/sec) Average response time = 3.44 (ms) MIN = 2.44 (ms) MAX = 4.77 (ms) No. measurements = 26 Final Report Incoming = 149 Outgoing = 149 ThroughPut = 14.89 (requests/sec) Average response time = 2.38 (ms) MIN = 1.15 (ms) MAX = 4.26 (ms) No. measurements = 139 |
|
||||
|
@ Annihilannic
What should I use instead of "-F" for this type of data. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| shell script, shell scripting, unix scripting, unix scripting basics |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|