I want to implement the following command recursively

sed -i 's/href=\"1\//href=\"\/1\//g' ./*

so that it replaces all href="1 with href="/1 in all sub-directories. Is there a flag I can add to this command to achieve the results I want?

link|improve this question

feedback

1 Answer

up vote 6 down vote accepted
find . -type f -print0 | xargs -0 sed -i 's/href=\"1\//href=\"\/1\//g'
link|improve this answer
the -o option doesn't exist...what does that do? – John Aug 20 '10 at 16:45
It should be -0 - it matches up with -print0 in the find - edited the post. – James Aug 20 '10 at 16:46
oh wait, maybe you meant -0 ... i tried the -0 and seemed to have done the trick – John Aug 20 '10 at 16:46
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.