On 2007.10.03 18:52 david wrote:
On Wed, 2007-10-03 at 18:44 +1000, Amos Shapira wrote:
> On 03/10/2007, david <[EMAIL PROTECTED]> wrote:
> Can you be more specific of what you are trying to achieve?

[EMAIL PROTECTED]:~/test/testdir $ cat > test
1
2
3
[EMAIL PROTECTED]:~/test/testdir $ sed s/1\n/1/g test
1
2
3
[EMAIL PROTECTED]:~/test/testdir $

The output I would have liked would be:

12
3

but sed doesn't seem to work like that. Pity.

I haven't got access to my references at the moment but sed **can** do what you want. I think the command is "H" (for "hold pattern space"). Anyway, sed can search for regexes that extend beyond one line -- particularly useful if you want to replace (say) "Sydney Linux Users Group" with "SLUG" and you suspect that "S... L... U... G..." may, or may not, be split over two lines.

Try googling for sed and "multiple line."

Robert Thorsby
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to