From owner-freebsd-questions@FreeBSD.ORG Mon Dec 25 14:41:52 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B0CC216A407 for ; Mon, 25 Dec 2006 14:41:52 +0000 (UTC) (envelope-from antennex@hotmail.com) Received: from bay0-omc2-s19.bay0.hotmail.com (bay0-omc2-s19.bay0.hotmail.com [65.54.246.155]) by mx1.freebsd.org (Postfix) with ESMTP id 9D48313C46F for ; Mon, 25 Dec 2006 14:41:52 +0000 (UTC) (envelope-from antennex@hotmail.com) Received: from hotmail.com ([65.55.130.114]) by bay0-omc2-s19.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Mon, 25 Dec 2006 06:41:52 -0800 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 25 Dec 2006 06:41:52 -0800 Message-ID: Received: from 65.55.130.123 by by125fd.bay125.hotmail.msn.com with HTTP; Mon, 25 Dec 2006 14:41:47 GMT X-Originating-IP: [65.68.247.73] X-Originating-Email: [antennex@hotmail.com] X-Sender: antennex@hotmail.com In-Reply-To: <20061225050447.GB4228@holestein.holy.cow> From: "Jack Stone" To: freebsd-questions@freebsd.org Date: Mon, 25 Dec 2006 08:41:47 -0600 Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-OriginalArrivalTime: 25 Dec 2006 14:41:52.0533 (UTC) FILETIME=[D11F8C50:01C72832] Subject: RE: OT: sed usage (was Re: Search & Replace Issue) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Dec 2006 14:41:52 -0000 >From: Parv >To: DeepTech >CC: freebsd-questions@freebsd.org >Subject: OT: sed usage (was Re: Search & Replace Issue) >Date: Mon, 25 Dec 2006 00:04:47 -0500 > >in message <458DFE11.1040201@hotpop.com>, >wrote DeepTech thusly... > > > > sed -e 's/http\:\/\/www\.domain\.htm\///g' *.htm > *.htm > >That will most likely destroy the original file(s). > >Depending on your shell, you will get redirection error from the shell >if there happen to be more than one file matching the pattern '*.htm'. > >In particular, in zsh 4.2.6 ... > > # cat p > polka dot > > # cp -f p q; cp -f p qq > # ls -l p q* > -rw------- 1 parv people 10 Dec 24 23:32 p > -rw------- 1 parv people 10 Dec 24 23:32 q > -rw------- 1 parv people 10 Dec 24 23:32 qq > > # sed -e '' q* >| q* > # ls -l q* > -rw------- 1 parv people 0 Dec 24 23:34 q > -rw------- 1 parv people 0 Dec 24 23:34 qq > > > > NOTE: not sure if u have to use a '\' before that ':' > >No, ':' need not be escaped. > > > - Parv sed -e 's/http\:\/\/www\.domain\.htm\///g' *.htm > *.htm Although it did not destroy the files, it didn't work, nor did most of the others. However, this one using perl DID work perfectly: perl -pi -e 's/http:\/\/www.cebik.com\///g' *.html None of the other SED(1) tips worked although I tried several times. The above is the only perl tip that worked for my purpose and it worked well. Although the SED(1) tips may have worked if I had enough time to debug, time was a factor. Glad the one worked as it saved an enourmous amount of time on this S&R effort. Again, many thanks for all the help! Best & Merry Xmas! Jack _________________________________________________________________ Fixing up the home? Live Search can help http://imagine-windowslive.com/search/kits/default.aspx?kit=improve&locale=en-US&source=hmemailtaglinenov06&FORM=WLMTAG