![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read a variable character by character, substitute characters with something else | vipervenom25 | UNIX for Dummies Questions & Answers | 2 | 06-06-2008 12:18 PM |
| comparing values of same variable | coolkid | Shell Programming and Scripting | 2 | 05-27-2008 02:45 PM |
| getting values from variable in a loop | kriuz | Shell Programming and Scripting | 3 | 01-22-2008 02:50 PM |
| assigning values to a variable | trichyselva | UNIX for Dummies Questions & Answers | 3 | 12-13-2007 10:55 PM |
| Substitute Variable | mmg2711 | UNIX for Dummies Questions & Answers | 0 | 10-26-2007 03:59 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
tmarikle,
I now have and get back. What do I have wrong? $ var_2=3 $ print "11 10 9 8 7 6 5 4 3 2 1" | awk -v var_2=$var_2 '{gsub(/var_2/," ",$0);print}' 11 10 9 8 7 6 5 4 3 2 1 I can't get this to work. I'm not use to stringing thing together and my scripts have been simple sed types. Sorry for all the notes but indeed thanks very much for the help. John |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
Sorry, /var_2/ was treated as a literal.
Code:
$ var_2=3
$ print "11 10 9 8 7 6 5 4 3 2 1" | nawk -v var_2=$var_2 '{gsub(" "var_2" "," ",$0);print}'
11 10 9 8 7 6 5 4 2 1
|
|
#10
|
|||
|
|||
|
tmarikle,
Thankyou so very much. |
|
#11
|
||||
|
||||
|
Quote:
|
|
#12
|
|||
|
|||
|
True, I would have to add a space before the 11 and after the 1.
|
|
#13
|
||||
|
||||
|
Quote:
that's cheatin' |
||||
| Google The UNIX and Linux Forums |