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

var from getline does not change

Status
Not open for further replies.

suhaimi

Technical User
Aug 3, 2001
71
US
Hi,
Why my variable "tt" does not change eventhough I continuously add couple of lines in to test.data file????

tail -f test.data|nawk '{"ls -ltr test.data"|getline tt;print tt;}'
-rw-r--r-- 1 oracle dba 2083 Jul 22 15:10 test.data
-rw-r--r-- 1 oracle dba 2083 Jul 22 15:10 test.data
-rw-r--r-- 1 oracle dba 2083 Jul 22 15:10 test.data

Rgds,
Suhaimi
 
Probably because awk isn't restarting the internal pipe you've set up

Try
Code:
tail -f test.data | 
  nawk '{"ls -ltr test.data"|getline tt;
         close("ls -ltr test.data");
         print tt;}'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top