HP3000-L Archives

January 2002, Week 5

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Danny van Delft <[log in to unmask]>
Reply To:
Danny van Delft <[log in to unmask]>
Date:
Wed, 30 Jan 2002 03:46:49 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (33 lines)
In article <[log in to unmask]>, "Ken Hirsch"
<[log in to unmask]> wrote:

> [log in to unmask] wrote:
>> followed by new lines. I thought it would be a simple matter to find
>> space 2\n\n\n, and replace with space 2\n\n\n\n: perl -pi -e 's/
>> 2\n\n\n/  2\n\n\n\n/' FILENAME
>>
>> And it's not working. And I am not sure why it is not working. Can
>> someone tell me why not, and what would work, instead?
>
> perl -p only reads one line at a time, so you're never going to match
> "\n\n" that way.
>
> If the file isn't too huge (i.e. can fit in memory), you can do this:
>
> perl -e 'undef $/;  $_ = <>; s/  2\n\n\n/  2\n\n\n\n/g; print' FILENAME
>>NEWFILE


Is not correct: this will append a newline to the right
sequence (" 2\n\n\n\n") as well.


>
> Otherwise, you'll have to actually write a program of 5-20 lines.


No need, see my other post.

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2