From owner-freebsd-questions@freebsd.org Thu Sep 24 16:02:07 2015 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4AF89A08587 for ; Thu, 24 Sep 2015 16:02:07 +0000 (UTC) (envelope-from milios@ccsys.com) Received: from cargobay.net (cargobay.net [198.178.123.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C2571DC5 for ; Thu, 24 Sep 2015 16:02:06 +0000 (UTC) (envelope-from milios@ccsys.com) Received: from [192.168.0.14] (cblmdm72-240-160-19.buckeyecom.net [72.240.160.19]) by cargobay.net (Postfix) with ESMTPSA id 4BEB6DE1 for ; Thu, 24 Sep 2015 15:56:37 +0000 (UTC) Subject: Re: Find and replace To: freebsd-questions@freebsd.org References: <2015092410262490833415@antennex.com> From: "Chad J. Milios" Message-ID: <56041E79.1030505@ccsys.com> Date: Thu, 24 Sep 2015 12:02:01 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <2015092410262490833415@antennex.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2015 16:02:07 -0000 On 9/24/2015 11:26 AM, chino@antennex.com wrote: > Am running FBSD-9.3 and apache-24 > > I need to find and replace several strings with "nothing" (not the word but a blank) and I cannot recall how to handle the syntax for the "new" portion if using sed as below. In other words, I want the *.html file to NOT display the graphic with the same pix.gif file name now there in about 1000 HTML files. > This script: sed -i.bak s/old/new/g fileLike this:#find, etc | sed -i.bak s/pix.gif//g fileThanks in advance for any help! > > > Warmest regards, > Mark Chino > -- > chino@antennex.com > www.antennex.com > you are looking for `xargs`. also consider using the `-print0` operator (thats a zero) with find along with `-0` flag to xargs if your filenames/directories contain any characters special to the shell (like spaces). find /within/this/directory -type f -print0 | xargs -0 sed -i.bak 's/find this/replace with that/g' as a side note, if you do exactly as you described, wont you be left with many broken tags? dont you want to remove the entire tag from your html?