[Gllug] parsing command output

- Tethys tethys at gmail.com
Wed Feb 14 20:16:11 UTC 2007


On 2/14/07, Gavin White <white.gavin at gmail.com> wrote:

> |strings      #remove blank lines

Yeesh! Use the right tool for the job (and strings is not that tool, here):

    sed '/^$/d'

Also, blank lines may well be valid output in this case, and removing
them could cause problems.

As Alain did, I'd just do the whole thing in sed (albeit a bit more
concisely than his):

    foo 2>&1 >/dev/null | sed -r '7,8!d;s/^ *([^ ]+ +){3}//;s/ .*//'

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




More information about the GLLUG mailing list