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 a variable to an awk sentence

Status
Not open for further replies.

mputmtab

Technical User
Apr 11, 2001
4
ES
I'm trying to have a file whithin two fields:
Ip address| dns domain

I have a script that will pipe a parm to awk:
while read line
do
/usr/sbin/nslookup $line | awk '$1=="Name:" {print $2}'
done<ip.int

where ip.int is a file containing the ip address. How can I obtain a file whith $line;$2 passing $line to the awk sentence?
 

Hi, mputmtab!

You can change awk sentence (if I good understood your problem):

awk '$1==&quot;Name:&quot; {print $0 &quot;;&quot; $2}'

Bye!

KP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top