Date: Mon, 2 Dec 2002 16:53:01 +0100 From: Roman Neuhauser <neuhauser@bellavista.cz> To: Paul Everlund <tdv94ped@cs.umu.se> Cc: Malik =?iso-8859-2?Q?B=FClent?= <bmalik@ihlas.net.tr>, questions@freebsd.org Subject: Re: is there a "replace command" ? Message-ID: <20021202155301.GB56031@freepuppy.bellavista.cz> In-Reply-To: <Pine.GSO.4.44.0212021632090.4600-100000@kvist.cs.umu.se> References: <012401c299fc$ed221f80$dc96eed5@ymmaslak> <Pine.GSO.4.44.0212021632090.4600-100000@kvist.cs.umu.se>
next in thread | previous in thread | raw e-mail | index | archive | help
# tdv94ped@cs.umu.se / 2002-12-02 16:36:21 +0100: > On Mon, 2 Dec 2002, [iso-8859-9] Malik Bülent wrote: > > > On Freebsd4.x > > I have a file. I want to change some expressions with new ones > > For example a file > > touch /var/qmail/1 > > touch /var/qmail/2 > > touch /var/qmail/3 > > touch /var/qmail/4 > > touch /var/qmail/5 > > touch /var/qmail/6 > > I want to change "touch" with "rm" > > How can i replace a newones in stead of a lot of expressions in a file on > > FreeBSD ? > > Which command(s) do i have to use ? > > Unfortunately I deleted your other mail, asking how to remove lines > containing some text in a file, but this might be one of many > solutions: > > # perl -e 'open(FD,"<file"); while(<FD>) { if(!($_ =~ /texttolookfor/)) { print "$_"; }} close(FD);' > file.tmp > > This has not been tested, so use it at your own risk. :-) how about this? even tested :) sed -i'' '/pattern/d' file -- If you cc me or remove the list(s) completely I'll most likely ignore your message. see http://www.eyrie.org./~eagle/faqs/questions.html To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021202155301.GB56031>