Piping to awk instead of using an input file... 
Author Message
 Piping to awk instead of using an input file...

 I'm trying to obtain the CVS version of a given file.  I can do this by
redirecting ouput to a file before calling awk.  But can someone tell me how
to do this by piping directly to awk, without using the extra 'myawk' output
file?

VERSION=`cvs status $ARG > myawk ; awk '{ if (NR == 4) print $3;}' myawk`

--
-----------------------------------------------------------------
Rod Brick
HillCast Technologies, Inc.
Austin, TX
(512) 474-4644   ext. 6
-----------------------------------------------------------------



Mon, 08 Dec 2003 09:11:01 GMT  
 Piping to awk instead of using an input file...

Quote:

> I'm trying to obtain the CVS version of a given file.  I can do this by
>redirecting ouput to a file before calling awk.  But can someone tell me how
>to do this by piping directly to awk, without using the extra 'myawk' output
>file?

>VERSION=`cvs status $ARG > myawk ; awk '{ if (NR == 4) print $3;}' myawk`

VERSION=`cvs status $ARG | awk '{ if (NR == 4) print $3;}' `

Chuck Demas

--
  Eat Healthy    |   _ _   | Nothing would be done at all,

  Die Anyway     |    v    | That no one could find fault with it.



Mon, 08 Dec 2003 09:53:45 GMT  
 Piping to awk instead of using an input file...
If no <filename> is specified to awk, it reads from stdin.  So you can
pipe one cammands output to the input of awk without using a temp file
between them...

Better check man page of awk.......

Regards,
Seenu.

Quote:

> I'm trying to obtain the CVS version of a given file.  I can do this by
> redirecting ouput to a file before calling awk.  But can someone tell me how
> to do this by piping directly to awk, without using the extra 'myawk' output
> file?

> VERSION=`cvs status $ARG > myawk ; awk '{ if (NR == 4) print $3;}' myawk`



Mon, 08 Dec 2003 21:39:28 GMT  
 Piping to awk instead of using an input file...
Damn!  I could have sworn I tried that, and it didn't work.  Guess I just
needed an expert opinion to make it start working this time.  Thanks.

--
-----------------------------------------------------------------
Rod Brick
HillCast Technologies, Inc.
Austin, TX
(512) 474-4644   ext. 6
-----------------------------------------------------------------

Quote:


> > I'm trying to obtain the CVS version of a given file.  I can do this by
> >redirecting ouput to a file before calling awk.  But can someone tell me
how
> >to do this by piping directly to awk, without using the extra 'myawk'
output
> >file?

> >VERSION=`cvs status $ARG > myawk ; awk '{ if (NR == 4) print $3;}' myawk`

> VERSION=`cvs status $ARG | awk '{ if (NR == 4) print $3;}' `

> Chuck Demas

> --
>   Eat Healthy    |   _ _   | Nothing would be done at all,

>   Die Anyway     |    v    | That no one could find fault with it.




Tue, 09 Dec 2003 01:00:08 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. piping input files into awk script

2. Outputting info from awk and using the info to name the awk output file

3. Write to 2 file from pipe without using temp file

4. Replacing a string from an input file within awk script

5. Multiple input files to awk

6. input from data file into awk under WindowsNT

7. can AWK read function from input file?

8. How to specify input file within awk script?

9. help on awk and ASCII file input

10. Q: Multi file input for AWK

11. Multiple input files in awk?

12. Q: Using arrays instead of using a list

 

 
Powered by phpBB® Forum Software