Chop and replace method??
freebsd at edvax.de
Sat Apr 4 22:22:06 UTC 2015
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).
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions