From owner-freebsd-questions Mon Dec 2 7:56:49 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B0C1937B401 for ; Mon, 2 Dec 2002 07:56:47 -0800 (PST) Received: from bellavista.cz (mail.bellavista.cz [62.168.44.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6289343EA9 for ; Mon, 2 Dec 2002 07:56:46 -0800 (PST) (envelope-from neuhauser@bellavista.cz) Received: from lilith.bellavista.cz ([10.1.0.1]) by bellavista.cz (8.9.3/8.9.8) with ESMTP id QAA28938; Mon, 2 Dec 2002 16:56:41 +0100 Received: from freepuppy.bellavista.cz (freepuppy.bellavista.cz [10.0.0.10]) by lilith.bellavista.cz (Postfix) with ESMTP id BE0B1246; Mon, 2 Dec 2002 17:54:58 +0100 (CET) Received: by freepuppy.bellavista.cz (Postfix, from userid 1001) id 95DC32FDAEE; Mon, 2 Dec 2002 16:56:40 +0100 (CET) Date: Mon, 2 Dec 2002 16:56:40 +0100 From: Roman Neuhauser To: Paul Everlund Cc: Malik =?iso-8859-2?Q?B=FClent?= , questions@freebsd.org Subject: Re: is there a "replace command" ? Message-ID: <20021202155640.GC56031@freepuppy.bellavista.cz> Mail-Followup-To: Paul Everlund , Malik =?iso-8859-2?Q?B=FClent?= , questions@freebsd.org References: <012401c299fc$ed221f80$dc96eed5@ymmaslak> <20021202155301.GB56031@freepuppy.bellavista.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20021202155301.GB56031@freepuppy.bellavista.cz> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG # neuhauser@bellavista.cz / 2002-12-02 16:53:01 +0100: > # 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,") { 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 gee, there must be whitespace betwwen -i and '' for this to work... -- 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