![]() |
|
|
|
|
|||||||
| 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 |
| Proxy ARP Difficulties | TheMaskedMan | IP Networking | 7 | 11-02-2005 06:14 AM |
| Simple Network Program Difficulties | Mistwolf | High Level Programming | 2 | 03-19-2002 02:34 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
||||
|
Here goes another unconventional way of passing variables to awk:
Code:
echo "Enter month: "
read MONTH
awk '/'$MONTH'/ { print ... }' file
The above approach does not work if the variable has whitespaces, newlines or certain special characters ( |, /, ...) in it. So it's always recommended using the conventional way -v var=... . Last edited by rubin; 05-11-2008 at 02:21 PM. Reason: last sentence |
||||
| Google The UNIX and Linux Forums |