From owner-freebsd-questions@FreeBSD.ORG Mon Dec 25 01:38:26 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 8C3DE16A403 for ; Mon, 25 Dec 2006 01:38:26 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (agora.rdrop.com [199.26.172.34]) by mx1.freebsd.org (Postfix) with ESMTP id 69BE313C466 for ; Mon, 25 Dec 2006 01:38:26 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id kBP1E1K6026885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 24 Dec 2006 17:14:01 -0800 (PST) (envelope-from perryh@pluto.rain.com) Received: (from uucp@localhost) by agora.rdrop.com (8.13.1/8.12.9/Submit) with UUCP id kBP1E1nX026884; Sun, 24 Dec 2006 17:14:01 -0800 (PST) Received: from fbsd61 ([192.168.200.61]) by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA06911; Sun, 24 Dec 06 17:09:31 PST Date: Sun, 24 Dec 2006 17:11:27 -0800 From: perryh@pluto.rain.com To: youshi10@u.washington.edu Message-Id: <458f253f.lr+F6Ryq//l/Tjtv%perryh@pluto.rain.com> References: <458EDE70.4050008@u.washington.edu> In-Reply-To: <458EDE70.4050008@u.washington.edu> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: 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 01:38:26 -0000 > >> From this: > >
  • > > > In other words, I just want the relative path and remove all > > the extra: http://www.domain.htm/ portions of the lines. ... > cat file.html | sed -e "s|http://www.domain.com||g" > file.tmp.html && > mv file.tmp.html file.html I don't think the "cat" accomplishes anything in a case like this (and BTW he also wanted to remove the / after com): sed -e "s|http://www.domain.com/||g" < file.html > file.tmp.html ... Additional logic (or use of -i) may be desirable to avoid loss of file ownership and permission settings.