I have thousands of HTML files that I would like to modify at the same time on a Fedora system.
It would be to replace style.css
by ../headers.css
and to replace another long chain that you can see here : http://pastebin.com/PHAz8Q4C
I'd recommend using a tool like sed
which can do text/regex replacements on a file.
Combining this with find
and xargs
is a good start to making it work on a large number of files.
So, for example, you could do something like
find -name "*.html" -print0 | xargs -0 sed -i 's#style.css#../headers.css#g'
Since there is no way to undo this operation, I would recommend making a backup of the files just in case (or use version control!)
EDIT: Guide on how to expand this to other search/replace terms (like your pastebin):
Same idea. Just make sure you escape everything properly. As an explanation that can get you further...
find
finds all the html
filesxargs
runs the command after it on each filesed
does the replacement-i
tells sed
to do it in places
tells it to Substitute
style.css
is what to replace../headers.css
is what to replace it withg
tells it to replace all occurrences in the file.