rpl a handy shell find and replace strings in file
I had 16000 over static html files in my server that I wanted to edit. Most of guides for doing this through shell command lines all pointed to either find, sed, awk or grep command, I found this very handy utility called "rpl". Well basically sed can do what rpl does, however when i tried with html tags i always got error :(, yeah cos I don't know how to use the sed syntax :).
anyway just apt-get it (apt-get install rpl) and it's ready to run...
a simple command from rpl thats saves me lotsa of time
:
rpl -R -x .php -x .html -x .htm '</body>' '<?php include "myads.php"; ?></body>' *
as you see, I was trying to insert php tags just before the body html tags, thats it, much simpler than sed :).
anyway just curious to all bashers out there, how would you guys do it in awk, sed or grep?...
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments
No comments yet.
Leave a comment