The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 2.00 average. Display Modes
  #8 (permalink)  
Old 11-02-2008
1184jap 1184jap is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 13
@ 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.
  #9 (permalink)  
Old 11-02-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
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
  #10 (permalink)  
Old 11-03-2008
1184jap 1184jap is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 13
@ Annihilannic
Thanks for all your help. I will try this out later on.
  #11 (permalink)  
Old 11-03-2008
1184jap 1184jap is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 13
@ Annihilannic
Perfect. Tnx again
  #12 (permalink)  
Old 12-01-2008
1184jap 1184jap is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 13
@ 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
  #13 (permalink)  
Old 12-01-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
That's because the input data is in a different format to your original example, which uses commas as field separators.

Just change the -F option to suit the input data.
  #14 (permalink)  
Old 12-02-2008
1184jap 1184jap is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 13
@ Annihilannic
What should I use instead of "-F" for this type of data.
Sponsored Links
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 06:03 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0