![]() |
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 |
| passing values into logrotate?? | imbiea | Shell Programming and Scripting | 1 | 06-09-2008 04:03 PM |
| passing variable values to awk command | jerardfjay | Shell Programming and Scripting | 1 | 05-22-2008 03:48 PM |
| passing values from sql to shell script | sachin.gangadha | Shell Programming and Scripting | 3 | 04-22-2008 11:11 PM |
| Passing Values from a shell script | dhananjaysk | Shell Programming and Scripting | 6 | 04-06-2006 09:33 AM |
| Passing values from SQR to UNIX | seeuinoz | UNIX for Advanced & Expert Users | 2 | 08-24-2005 03:54 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
found that passing (input) values to awk, all work well. For example:
errpt | awk 'BEGIN { errore=0 } substr($2,1,4) /'ParamData'/ { .... } ' ParamData=`date +"%m%d"` Now I wish to obtain (output) a value. Using this method is it possible to re-write ParamData, for example? Thanks in advance for your kind cooperation. Regards. Giovanni |
|
||||
|
Ygor really a expert in awk!! I viewed his posts and I still need to learn from him/her.
I know that is one of method to set variable in awk. And I know 3 methods to do that, maybe more than 3 ways then I may not know. Method 1: Variable was assigned after any actions, var cannot be read in BEGIN {} because action in BEGIN {} is started before reading the script. awk '{print $0}' var=$1 filename Method 2: One variable with one -v, variable can be read in BEGIN{} and the script. awk -v var1=$1 -v var2=$2 '{print $0}' filename Method 3: assign variable in the script body. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|