On Mon, Aug 14, 2006 at 07:45:34AM -0700, Dominick Cancilla wrote: > I've got a GREP problem I can't seem to wrap my head around. > > I have a text file in which a number of file names are listed like this: > > foo1.jpg > foo2.jpg > foo3.jpg > foo4.jpg > foo5.jpg > etc. > > I'd like to end up with a file like this: > > foo1.jpg foo2.jpg foo3.jpg > foo2.jpg foo3.jpg foo4.jpg > foo3.jpg foo4.jpg foo5.jpg > etc. > > Any suggestions?
If I'm understanding your example properly, you want each filename in the file to be followed on the same line by the next two filenames... Find: (\S+)\r(?=(\S+)(?:\r(\S+))?) Replace: \1 \2 \3\r (?=) is a positive look-ahead that matches without consuming, so that the next match starts on the next line rather than three lines down. This will put an extra space at the end of the second-to-last line, unfortunately. I'm not sure that can be avoided with a single grep. Ronald -- ------------------------------------------------------------------ Have a feature request? Not sure the software's working correctly? If so, please send mail to <[EMAIL PROTECTED]>, not to the list. List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml> List archives: <http://www.listsearch.com/BBEditTalk.lasso> To unsubscribe, send mail to: <[EMAIL PROTECTED]>
