extract all text lines between 2 lines in a file?

Tom Buskey tom at buskey.name
Wed Apr 7 15:06:02 EDT 2004


> Oops, sorry about last post....
> I have a file:

Haha on the comments ;-)
/me blames using squirrelmail and hitting tab then return

> #!/bin/sh
>
> command1
> command2
> uniqdelimiter
> command3
> command4
> uniqdelimiter
> command5
>
> I want to filter it and get:
> command3
> command4
>
> In other words, everything between the lines that say "uniqdelimter".
>
> This will do it:
> sed '0,/^uniqdelimiter/d' file  | sed '/^uniqdelimter/d'
>
> but I'd like a one liner in sed, grep or awk.  I'll settle for perl too
> :-)
>

I answered my own question:

sed '0,/^uniqdelimiter/d' -e '/^uniqdelimter/d' file






More information about the gnhlug-discuss mailing list