From owner-freebsd-questions@FreeBSD.ORG Fri May 13 10:43:19 2005 Return-Path: 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 3EC1416A4CE for ; Fri, 13 May 2005 10:43:19 +0000 (GMT) Received: from fri.itea.ntnu.no (fri.itea.ntnu.no [129.241.7.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D22A43D54 for ; Fri, 13 May 2005 10:43:16 +0000 (GMT) (envelope-from svein-freebsd-questions@theloosingend.net) Received: from localhost (localhost [127.0.0.1]) by fri.itea.ntnu.no (Postfix) with ESMTP id 8C9B58359 for ; Fri, 13 May 2005 12:43:15 +0200 (CEST) Received: from maren.thelosingend.net (maren.math.ntnu.no [129.241.211.48]) by fri.itea.ntnu.no (Postfix) with SMTP for ; Fri, 13 May 2005 12:43:15 +0200 (CEST) Received: (qmail 5981 invoked by uid 1001); 13 May 2005 10:43:14 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 13 May 2005 10:43:14 -0000 Date: Fri, 13 May 2005 12:43:14 +0200 (CEST) From: Svein Halvor Halvorsen X-X-Sender: sveinhal@maren.thelosingend.net To: "Sergey S. Ropchan" In-Reply-To: <1115977253.28135.17.camel@sirius> Message-ID: <20050513122232.O5526@maren.thelosingend.net> References: <20050513092905.D003E4BEAD@ws1-1.us4.outblaze.com> <1115977253.28135.17.camel@sirius> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Content-Scanned: with sophos and spamassassin at mailgw.ntnu.no. cc: questions@freebsd.org cc: Fafa Hafiz Krantz Subject: Re: How to replace words in all files? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2005 10:43:19 -0000 * Sergey S. Ropchan [2005-05-13 12:40 +0300] > find / -name '*' -print | xargs grep "lnc0" > - gives you all files in your system with lnc0 ... > > perl -pi.bak -pe 's/lnc0/rl0/' file1 file2 ... fileN > - will replace lnc0 - rl0 in all specified files, with backuping of old > files in *.bak Or one could use with the -i option, since sed is in the base system (although everyone probably has perl anyway)