From owner-freebsd-questions@FreeBSD.ORG Sat Apr 4 22:22:06 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D38223E for ; Sat, 4 Apr 2015 22:22:06 +0000 (UTC) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2C4CE37C for ; Sat, 4 Apr 2015 22:22:05 +0000 (UTC) Received: from r56.edvax.de (port-92-195-131-196.dynamic.qsc.de [92.195.131.196]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 852363CC35; Sun, 5 Apr 2015 00:21:56 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id t34MLnGh003279; Sun, 5 Apr 2015 00:21:50 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sun, 5 Apr 2015 00:21:49 +0200 From: Polytropon To: Jon Radel Subject: Re: Chop and replace method?? Message-Id: <20150405002149.e11077b2.freebsd@edvax.de> In-Reply-To: <55202099.9090908@radel.com> References: <55202099.9090908@radel.com> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Nancy Belle , freebsd-questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Apr 2015 22:22:06 -0000 Allow me a little improvement for readability: On Sat, 04 Apr 2015 13:34:17 -0400, Jon Radel wrote: > sed -i .bak 's/href=\"..\/..\/..\/archival\/archive13\//href=\"/' *.html You're using \/ to distinguish the '/' characters from the / in the regex. But you don't have to - just replace the / of the sed command with something that is _not_ part of the search & replace expression, for example |, such as: % sed -i .bak 's|href="../../../archival/archive13/|href="|' *.html As you can see, escaping " inside '...' also isn't neccessary. Depending on the patterns in the input, you could add 'g' for global search & replace (here: like s|before|after|g). -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...