logo       

Re: Stingily extracting a block of lines: msg#00014

editors.sed.user

Subject: Re: Stingily extracting a block of lines

Rachel Cogent wrote:

> I want to extract a range of lines beginning with the word 'bundle' and
> ending with the word '.eml,'. The 'bundle' delimiter will occur
> repeatedly throughout the file, so I want to use the most recent instance
> (greedy).
>
> How would I do it using sed?

You're being too vague. Guessing that your data looks like

the beginning
foo
foo bundle bar 1
bar
baz
foo bundle baz 2
noise
noise
bar .elm
noise
the end

Then the sed script is simply:

sed -n '/bundle/,/\.elm/p' input.txt > output.txt

Angus




------------------------ Yahoo! Groups Sponsor --------------------~-->
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/dkFolB/TM
--------------------------------------------------------------------~->

--

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/

<*> To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/







<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise