[Gllug] parsing command output
Stuart Sears
stuart at sjsears.com
Wed Feb 14 20:48:47 UTC 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Tethys wrote:
> Yes indeed. Your use of file descriptor 3 in the above command is
> unnecessary. You could have just said:
>
> command 2>&1 >/dev/null
fair enough... the whole file descriptor thing throws me sometimes.
originally, looking at that I would have assumed that would send both stderr
and stdout to /dev/null. but the order changes that, I see...
/me puts his reading specs back on.
>> 2. I am no awk expert (to say the least. I am not even an awk
>> amateur.), but it is outstanding at pulling out 'random' fields
>> separated by whitespace. perhaps someone can enlighten me as to how
>> I make it only print lines 7 and 8?
>
> command 2>&1 >/dev/null | awk '{ if (NR==7||NR==8) print $4; }'
Thanks
Stuart
- --
Stuart Sears RHCA RHCSS RHCX PEBKAC STFU
"Quit worrying about your health. It'll go away."
- - Robert Orben
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFF03WvamPtx1brPQ4RAi8VAJ0USJ2mQZMMXxviCTinT0ppYKUHMwCeNNce
hfiGmyOPAZ/E2eU4fwOPdCQ=
=h2X1
-----END PGP SIGNATURE-----
-------------- 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