problem with sed command and csh

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Jun 19 07:54:16 UTC 2007


On 2007-06-18 11:33, Olivier Regnier <oregnier at oregnier.net> wrote:
> I founded solution with awk command and that works well.
>
> cat /usr/local/etc/pkgtools.conf | awk '{ sub(/^[ \t]*MAKE_ARGS = {/, 
> "&\n\t\x27ports-mgmtp/portupgrade\x27 => 
> \x27WITH_BDB4=1\x27,\n\t\x27sysutils/fastest_csvsup\x27 => 
> \x27WITH_ROUNDTRIP=1\x27,\n\t\x27mail/nbsmtp\x27 => \x27WITH_IPV6=1 
> WITH_SSL=1\x27,\n"); print; }' > /usr/local/etc/pkgtools.conf

I'm sure you really do *NOT* want to read and write to the same file in
a single shell pipeline.  Watch out for the cookie monster which feeds
on the remains of zeroed out files :-P



More information about the freebsd-questions mailing list