Computing.Net > Forums > Unix > Export variables from awk

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

Reply to Message Icon

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???



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: December 29, 2005 at 00:41:09 Pacific
Reply:

you can try the "eval" command

eg eval `awk .....`


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Export variables from awk

export variables www.computing.net/answers/unix/export-variables/4268.html

variables from one file to another www.computing.net/answers/unix/variables-from-one-file-to-another/7378.html

To use variables in AWK www.computing.net/answers/unix/to-use-variables-in-awk/8025.html