On Wed, Oct 03, 2007 at 06:52:17PM +1000, david wrote: > On Wed, 2007-10-03 at 18:44 +1000, Amos Shapira wrote: > > On 03/10/2007, david <[EMAIL PROTECTED]> wrote: > > > > > > I want to edit a multi line file as if it were all one line > > > > > > In other words, treat \n like any other character, and specifically > > > doing global find and replace. > > > > > > I know there are various hex editors, but they are all pretty clunky as > > > far as I can see, and none seem to be able to do that from command line. > > > > > > Is there a shell script way to do it? > > > > > > 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
nox:~/tmp$ cat > test 1 2 3 nox:~/tmp$ nox:~/tmp$ perl -i -pe 's/1\n/1/' test nox:~/tmp$ cat test 12 3 nox:~/tmp$ Cheers, Gavin -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
