[ILUG] sed question

Padraig Brady padraig.brady at corvil.com
Thu Feb 19 19:48:40 GMT 2004


OK I've a (very big) file like:

0
0
1
1
2
2
3
3
:

I would like to find and print the "2" lines,
AND THEN STOP PRCOCESSING the humungous file.

I was thinking of using sed, and the q command.
I have to maintain state someplace I think,
and I guess the hold space is the place to do it,
but I'm confused.

I got as far as sed -n '/2/{p;b};q'
but that doesn't deal with the case where there
are initial lines that don't match.

Pádraig.





More information about the ILUG mailing list