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?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Per https://stackoverflow.com/a/5130044/833771, if the target directory is a Git or SVN root, you should use:
find . -not \( -name .svn -prune -o -name .git -prune \) -type f -print0 | xargs -0 sed -i 's/href=\"1\//href=\"\/1\//g'