Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Export variables from awk
Name: vicchai Date: December 28, 2005 at 23:57:36 Pacific OS: HPUX CPU/Ram: Nil
Comment:
Hi,
How can I export variables from awk? For example, I have this script: cat awkscr #start of scr bdf | awk '(/ *% /) && (length($NF)>maxl) {maxl=length($NF)} END {print maxl; export maxl}' echo $maxl #end of scr The echo return nothing. I know I can do it in this way: maxl=`bdf | awk '(/ *% /) && (length($NF)>maxl) {maxl=length($NF)} END {print maxl}'` but if I have 2 or more variables need to pass back to the shell, this doesn't work. Any idea???
Summary: I am having trouble exporting variables set in a script to a function inside the script. 1. The variable must be set outside the function because it will be called outside as well as inside the functi...
Summary: Hey guys, I need some help with some unix stuff. I have two files. One is a script and the other is a config file. The script has to use the variables from the config file to operate. For exampl...
Summary: Hi my script is to collect the duplicate records in the file. the script is as follows. sort -t, -k 1,1 -k3,6 datafile.csv | awk -F, 'BEGIN { getline holdline=$0 holdkey=$1$3$4$5$6 ...