Subject: Re: sed \n question
To: John Maier <jmaier@midamerica.net>
From: Mike Pelley <mike.pelley@coventus.com>
List: netbsd-help
Date: 10/02/2000 11:15:58
> I'm trying to write a script to delete specific lines from a file, i.e.:
> sed -e 's|'$1' yes\n||g' < /etc/ftpchroot > /etc/ftpchroot.new
>
> But it doesn't seem to interpret the \n as a newline character, in the
> search expression.

sed is line-oriented by default - you'll need to convince it to read the
next line before attempting the substitution to get the carriage return into
the buffer.  Something like

  sed -e '/^'$1' yes$/{N;s|'$1' yes\n||g;}' < /etc/ftpchroot >
/etc/ftpchroot.new

should work - basically, match the line, and if it matches get the next line
and do a substitution.

I haven't tested this so caveat emptor ;o)

CU!  Mike.