Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > awk pipe and sy...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 2208 of 2317
Post > Topic >>

awk pipe and system call

by "uwcssa@[EMAIL PROTECTED] " <uwcssa@[EMAIL PROTECTED] > Mar 28, 2008 at 07:59 AM

i have two problems with awk:

first, the following works on my system, which shows system usage

    iostat 2 | awk '{print $1}'

However, the following seems never gets written to the log file

       iostat 2 | awk '{print $1}'  > log

It may gets buffered inside awk, is there a way to turn auto buffer
off?


Second problem is that I found it is impossible to send variables to
system calls:
the following works inside awk script:

       system( "echo " $0);

However, the following never works:

      BEGIN{ myvar1=0;}
      { myvar2 =1;
        system("echo " $myvar1  $myvar2);

Any ideas? thanks a bunch
 




 7 Posts in Topic:
awk pipe and system call
"uwcssa@[EMAIL PROTE  2008-03-28 07:59:31 
Re: awk pipe and system call
pk <pk@[EMAIL PROTECTE  2008-03-28 16:27:36 
Re: awk pipe and system call
Ed Morton <morton@[EMA  2008-03-28 10:15:45 
Re: awk pipe and system call
pk <pk@[EMAIL PROTECTE  2008-03-28 16:40:43 
Re: awk pipe and system call
Ed Morton <morton@[EMA  2008-03-28 10:42:12 
Re: awk pipe and system call
privat@[EMAIL PROTECTED]   2008-04-25 10:23:19 
Re: awk pipe and system call
Janis Papanagnou <Jani  2008-04-27 12:06:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 20:22:19 CDT 2008.