[Gllug] parsing command output

Tethys sta296 at astradyne.co.uk
Wed Feb 14 21:21:44 UTC 2007


salsaman at xs4all.nl writes:

>That's almost what I wanted. In fact, the script I will use is:
>
>command 2>&1 | awk '{ if (NR==7||NR==8) print $5; }' > output.txt
>
>Since nothing is output on stdout, the redirection to /dev/null is
>uneccessary; and since the lines in question start with spaces I'll take
>field 5 (the formatting was lost on my original post).

Are you sure that's what you want? You know that awk ignores leading
whitespace when determining field numbers, don't you? So using $4 is
still correct.

Tet
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list