On Mon, 2 Mar 2009 13:01:31 +1100
Adam Carter <adam.car...@optus.com.au> wrote:

> I need to select all the lines between string1 and string2 in a file. String1 
> exists on an entire line by itself and string2 will be at the start of a 
> line. What's the syntax? I cant use -A as there is a variable number of lines.

I doubt there's a solution involving grep, unless you use it twice in
the same pipe:
  grep -A9999 string1 /some/file | grep -B 9999 string2

But there can be any amount of more elegant solutions, involving
sed:
  sed -n '/string1/,/string2/p' /some/file

-- 
Mike Kazantsev // fraggod.net

Attachment: signature.asc
Description: PGP signature

Reply via email to