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 *