![]() |
|
|
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 |
| how to access values of awk/nawk variables outside the awk/nawk block? | saniya | Shell Programming and Scripting | 5 | 05-13-2008 08:37 AM |
| NEW: need help with nawk using -v vars | wakhan | Shell Programming and Scripting | 20 | 04-26-2008 05:44 AM |
| Passing Vars between scripts | rcunn87 | Shell Programming and Scripting | 4 | 06-23-2006 07:07 AM |
| Can I export vars without polluting my namespace? | tphyahoo | Shell Programming and Scripting | 2 | 06-06-2006 12:03 PM |
| Env vars in a SED script | Bags | Shell Programming and Scripting | 8 | 05-12-2006 03:53 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
need help with nawk using -v vars
I'm trying to pass nawk a shell variable to be used in a pattern match. I can't get this work.
I'm calling nawk from a /bin/sh echo " Input file: \c" read var1 echo " Input: \c" read var2 nawk -F"|" -v x=$1 ' BEGIN $15 ~ /^'$var2'/ {print $2}' var1 {apary=$15; bparty=$23; time=$4; duration=$43; account=$65; charge=$66} END { print apary"|"bparty"|"vrijeme"|"duration"|"account"|"charge } ' $1 >> final so I should read from file var1 and search for pattern var2 and put all that in file final. PLEASE can anyone help me out with this code somehow it does not work.. THANKS in advance |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|