For multiline edititing in sed, read about N and read about the hold space, too. Joel
On Mon, Jun 02, 2003 at 09:24:24AM -0700, [EMAIL PROTECTED] wrote: > I'm attempting to write a script that will delete a certain portion of a > data file. What I want to do is delete everything between (and including) > two lines, line A and line B > > The "file": > ... > #lineA > ... > #lineB > ... > > To an extent I don't really care what tool is used, but I've been unable > to accomplish the task with either Perl or SED so I'm wondering if there > might be something wrong with the regular expressions that I've tried. > > A couple of the reg-exp's that I've tried: > 's/#lineA.*#lineB//gs' > 's/#lineA(.|\n)*#lineB//gs' > > Both of the above seem to work fine if #lineA and #lineB are on the same > line in the file (I've yet to add in anything to check if #lineA and > #lineB occur at the start of the line, but that'll be added in later). > Shouldn't the /s modifier allow multi-line matching to take place? > > David Aikema > _______________________________________________ > Linux-users mailing list > [EMAIL PROTECTED] > Unsubscribe/Suspend/Etc -> http://www.linux-sxs.org/mailman/listinfo/linux-users _______________________________________________ Linux-users mailing list [EMAIL PROTECTED] Unsubscribe/Suspend/Etc -> http://www.linux-sxs.org/mailman/listinfo/linux-users
