From owner-freebsd-questions Mon Dec 2 7:53:22 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 1D22037B401 for ; Mon, 2 Dec 2002 07:53:21 -0800 (PST) Received: from bellavista.cz (mail.bellavista.cz [62.168.44.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 670B543EAF for ; Mon, 2 Dec 2002 07:53:19 -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 QAA28883; Mon, 2 Dec 2002 16:53:04 +0100 Received: from freepuppy.bellavista.cz (freepuppy.bellavista.cz [10.0.0.10]) by lilith.bellavista.cz (Postfix) with ESMTP id CC54524C; Mon, 2 Dec 2002 17:51:21 +0100 (CET) Received: by freepuppy.bellavista.cz (Postfix, from userid 1001) id E301F2FDAFB; Mon, 2 Dec 2002 16:53:01 +0100 (CET) Date: Mon, 2 Dec 2002 16:53:01 +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: <20021202155301.GB56031@freepuppy.bellavista.cz> Mail-Followup-To: Paul Everlund , Malik =?iso-8859-2?Q?B=FClent?= , questions@freebsd.org References: <012401c299fc$ed221f80$dc96eed5@ymmaslak> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 # 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 -- 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