Computing.Net > Forums > Programming > Help.... awk

Help.... awk

Reply to Message Icon

Original Message
Name: mark
Date: March 19, 2002 at 02:13:36 Pacific
Subject: Help.... awk
Comment:

Help…
I have a bash script and within the script I have a variable TEMP which is loaded with space-delimited text from a short c-prog.
This prog always outputs 3 strings of data say: MOUSE CAT DOG. Using "echo $TEMP | awk '{ print $0 }' "I can get hold of either the 1st/2nd/3rd output variable to put into other progs. However the prog can also output n extra bits of info.

How can I, using awk , isolate all the output above the third (since the first three are always there)

Thanks


Report Offensive Message For Removal

Response Number 1
Name: Chris-M
Date: March 19, 2002 at 05:20:10 Pacific
Subject: Help.... awk
Reply: (edit)

I suggest you take this to the programming forum. *confused look*

-Chris


Report Offensive Follow Up For Removal

Response Number 2
Name: Chris-M
Date: March 19, 2002 at 05:21:50 Pacific
Subject: Help.... awk
Reply: (edit)

Wah!
This IS the programming forum... o_O

*goes back to old peoples home*

-Chris


Report Offensive Follow Up For Removal

Response Number 3
Name: Guy
Date: March 19, 2002 at 08:45:05 Pacific
Subject: Help.... awk
Reply: (edit)

Hi - I am going to guess you are looking for something like:

echo $TEMP | awk '{for i=3; i printf "%s", $i; \
printf "%s\n", ""; \
}'

HTH, Guy


Report Offensive Follow Up For Removal

Response Number 4
Name: danny
Date: March 19, 2002 at 18:02:33 Pacific
Subject: Help.... awk
Reply: (edit)

var3=`echo $TEMP | awk '{ print $3 }'`


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Help.... awk

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software