From owner-freebsd-questions@FreeBSD.ORG Sat Apr 4 17:39:21 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 795E483B for ; Sat, 4 Apr 2015 17:39:21 +0000 (UTC) Received: from mail-qk0-x22b.google.com (mail-qk0-x22b.google.com [IPv6:2607:f8b0:400d:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2BB791DF for ; Sat, 4 Apr 2015 17:39:21 +0000 (UTC) Received: by qkhg7 with SMTP id g7so2013034qkh.2 for ; Sat, 04 Apr 2015 10:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=KTF6wD/lqKzEJgXnIyrk5pIhkLGGuLBv6lqE+YNVPTA=; b=cRZ9C7FWnZsyuW6s/X7x3XZYZg3OvifCjFYU02QaqEnxk1z2o26rJQq32dJsjn4pkx HXByy4eA21wdMxMzmzuiXGeubMXth6VpxLXqxh8ajfiEytQY5Vt/iWyJWgc/X6RmZ2wV iW/QoXN4dq3v40AwMXaIFh30FooObsfTzPJosraXTf43cUj6pXCfnWd0E6jPT/uwLmTC nTYqu5Z89MgN+2OYtHj4/o+dIE/YMiDaxrhZsYIUnoy1Qbdz670wovPwOH5N0ITntxcq 6NXYqcIZvCtRvt5wE88YEZLC0w5cFE1PJ9iPbKEWC3Cxvi5cKrQVMiX7mB0y/PUMs43O 6nsA== X-Received: by 10.55.55.8 with SMTP id e8mr14434542qka.9.1428169160284; Sat, 04 Apr 2015 10:39:20 -0700 (PDT) Received: from localhost.localdomain ([209.181.150.218]) by mx.google.com with ESMTPSA id s7sm8219452qgd.4.2015.04.04.10.39.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Apr 2015 10:39:19 -0700 (PDT) Message-ID: <552021C5.3010309@gmail.com> Date: Sat, 04 Apr 2015 11:39:17 -0600 From: jd1008 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Re: Chop and replace method?? References: <55202099.9090908@radel.com> In-Reply-To: <55202099.9090908@radel.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.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 17:39:21 -0000 On 04/04/2015 11:34 AM, Jon Radel wrote: > On 4/4/15 12:48 PM, Nancy Belle wrote: >> Hi freebsd-questions >> >> I have a really big problem to solve and save hours & hours of time >> to correct hundreds of file links because of moving a very large >> section within a web site. I have this now: >> >> 1) > href="../../../archival/archive13/Jan14/Jan114/intro-frankant.html"> >> >> and need to chop off this portion of above link example: >> 2) ../../../archival/archive13/ >> >> leaving this as the correct link instead: >> 3) >> >> The front portion to chop is always the same while the rest of the >> link always varies and should be left as is. >> > As always, it pays to have a really good backup before applying random > scripts that can trash your files in one easy step, particularly those > from friendly strangers on the Internet. :-) > > sed -i .bak 's/href=\"..\/..\/..\/archival\/archive13\//href=\"/' *.html > > should do what you asked for. But test on copies. Really! > > And use a different extension than .bak if you already have .bak files > you care about. > > --Jon Radel > jon@radel.com > > > Hi Jon, should not the args include -s, --separate consider files as separate rather than as a single continuous long stream.