![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Storing count(*) into unix variable | mervinboyz | Shell Programming and Scripting | 1 | 03-26-2008 11:14 PM |
| Storing a variable? | hoover90 | Shell Programming and Scripting | 4 | 01-26-2008 09:39 PM |
| Using 'defaults read' and storing the output in a variable | davewg | Shell Programming and Scripting | 0 | 11-14-2007 08:04 AM |
| Storing the output into a variable | ravi raj kumar | UNIX for Dummies Questions & Answers | 7 | 12-11-2006 09:14 AM |
| Storing values in variable | matrixmadhan | Shell Programming and Scripting | 1 | 04-01-2005 01:56 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
storing output of awk in variable
HI
I am trying to store the output of this awk command awk -F, {(if NR==2) print $1} test.sr in a variable when I am trying v= awk -F, {(if NR==2) print $1} test.sr $v = awk -F, {(if NR==2) print $1} test.sr but its not working out . Any suggestions Thanks Arif |
|
||||
|
Here is a script in csh that works.
Notice the back ticks before awk and after the file name , your test file name. It worked fine for me. #!/bin/csh set v=`awk -F, 'NR == 2 {print $1}' test.sr` echo $v >> outputfile "this will append the value of v to a file" Last edited by bdsffl; 05-07-2006 at 03:25 PM.. |
|
||||
|
Thanks everybody for your help ,I got it .
Thanks |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|