From owner-freebsd-questions@FreeBSD.ORG Fri Jan 28 05:56:18 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 B5A6716A4CE for ; Fri, 28 Jan 2005 05:56:18 +0000 (GMT) Received: from smtp1.wanadoo.fr (smtp1.wanadoo.fr [193.252.22.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6959C43D2F for ; Fri, 28 Jan 2005 05:56:18 +0000 (GMT) (envelope-from atkielski.anthony@wanadoo.fr) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf0102.wanadoo.fr (SMTP Server) with ESMTP id 883451FFFD26 for ; Fri, 28 Jan 2005 06:56:17 +0100 (CET) Received: from pix.atkielski.com (ASt-Lambert-111-2-1-3.w81-50.abo.wanadoo.fr [81.50.80.3]) by mwinf0102.wanadoo.fr (SMTP Server) with ESMTP id 6F1F11FFFD22 for ; Fri, 28 Jan 2005 06:56:17 +0100 (CET) X-ME-UUID: 20050128055617455.6F1F11FFFD22@mwinf0102.wanadoo.fr Date: Fri, 28 Jan 2005 06:56:16 +0100 From: Anthony Atkielski X-Priority: 3 (Normal) Message-ID: <1098984237.20050128065616@wanadoo.fr> To: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: One-line global string replace in all files with sed (or awk?) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: freebsd-questions@freebsd.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jan 2005 05:56:18 -0000 My thanks to all who replied. I ended up using this form (I don't recall who suggested it): find . -type f | xargs sed -i '' -e 's/foo/bar/g' One problem, though: It appears that sed touches every file, resetting the last modification time, even if it didn't actually change anything. This reset the last modification dates for every file on my site, which wasn't much fun. Is there another command I could put between find and xargs that would filter only the names of files containing the string? (grep would do it, but grep outputs the lines found to stdout, so that won't do.) -- Anthony