Date: Sat, 04 Apr 2015 11:39:17 -0600 From: jd1008 <jd1008@gmail.com> To: freebsd-questions@freebsd.org Subject: Re: Chop and replace method?? Message-ID: <552021C5.3010309@gmail.com> In-Reply-To: <55202099.9090908@radel.com> References: <DM__150404113753_01984604235@mail.antennex.com> <55202099.9090908@radel.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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) <a >> 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) <a href="Jan14/Jan114/intro-frankant.html"> >> >> 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?552021C5.3010309>