![]() |
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 |
| use variable for sed print line | atchleykl | UNIX for Dummies Questions & Answers | 3 | 02-23-2009 01:49 PM |
| How to print a value in the variable using awk ? | jisha | Shell Programming and Scripting | 1 | 01-14-2008 07:45 AM |
| print variable in file using awk | kamel.seg | Shell Programming and Scripting | 3 | 01-03-2008 06:43 AM |
| can awk print column using a variable ?? | jambesh | Shell Programming and Scripting | 36 | 09-26-2006 08:39 AM |
| print the name of variable | sun-guy | Shell Programming and Scripting | 1 | 08-06-2006 06:03 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
try using the -v switch when passing variables into Awk
awk -v foo=$ph ...... Here is a link Using Shell Variables in Awk Last edited by google; 05-13-2004 at 08:52 AM.. |
|
||||
|
i try it but it does not work it give me error
suppose "ph" is a variable were calculated before ph= bla bla bla and i have an input file as aaa|1234 bbb|6325 ccc|7454 aaa|5467 i wanna to print in out put file second field of the line that contian aaa and at the end of each line the value of the variable. so the output will be 1234 bla bla bla 5467 bla bla bla and thnx in advance |
|
||||
|
i try the folowing code "just for testing" i get the following error
operate >tail ACCL.txt|awk -v ph="bla bla bla" '{print $2, ph}' awk: syntax error near line 1 awk: bailing out near line 1 and does this work if i ph calculated by exprestion as ph = `cat file` |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|