Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable = system(do something) 2

Status
Not open for further replies.

pieretto

Technical User
Jan 30, 2008
7
US
Hi all,

in an awk script do you know if is possible to give a value from a "unix output command" to a variable?

I know that in a shell script I can give a value to a variable from a command output in this way:
In example: var1=`tail -1 InputFile.txt`

I need to do that in an awk script, so I'm thinking somenthing like this:

syscommand = "tail -1" InputFile "
var1 = system(syscommand)

but it doesn't work.

Do you have any suggestions?

Thanks
Piero
 
syscommand = "tail -1 " InputFile
syscommand | getline var1

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Great!! It seems to work properly!
Thank you my friend!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top