|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Global Variable in awk...
i think.....
it's possible use a variable out a awk in the awk ??? ex. A=20071225 awk '{ print "the value is" $a }' OR awk '{ print "........"; c=10; print $c ; c=$A ; print $A}' for a external variable is possbile use in the awk ??? |
| Sponsored Links | |
|
|
|
#2
|
||||
|
||||
|
You can do : Code:
A=20071225
awk '{ print "the value of A is" '"$A"' }' infileOr Code:
A=20071225
awk -v A="$A" '{ print "........"; c=10; print $c ; c=A ; print A}' infileor Code:
A=20071225
awk '{ print "........"; c=10; print $c ; c=A ; print A}' A="$A" infileor Code:
export A=20071225
awk '{ c=ENVIRON["A"] + $1; print c}' infile |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| global variable not being set | robotball | Shell Programming and Scripting | 5 | 06-10-2008 06:20 AM |
| global variable in awk | anhtt | Shell Programming and Scripting | 1 | 03-16-2008 02:55 PM |
| setting a global variable in script | arunkumar_mca | UNIX for Dummies Questions & Answers | 3 | 10-23-2007 07:46 AM |
| Global Variable in a script? | skyineyes | Shell Programming and Scripting | 2 | 07-12-2007 06:55 AM |
| Global variable becomes local | odashe318 | Shell Programming and Scripting | 2 | 10-29-2004 09:18 PM |
|
|