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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exporting AWK variables to unix shell variable

Status
Not open for further replies.

applebala

Programmer
Mar 6, 2001
8
US
Hi

I have this awk script and I want to export the number of records to Unix shell !!!

awk -F: '$1 !~ "#" { print $1 }; END { lines=NR }' filename

I want to access the "lines" variable in Unix shell.

Can anyone help me...
thanks in advance
Bala
 
Hi Bala,

sh:

varib=`awk -F: '$1 !~ /#/ { print $1 } END { lines=NR ; print lines }' bala | tee alab | tail -1`
echo $varib
more alab


csh:

set varib=`awk -F: '$1 !~ /#/ { print $1 } END { lines=NR ; print lines }' bala | tee alab | tail -1`
echo $varib
more alab

Hope this helps you!


flogrr
flogr@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top