IPv6 Launchipv6 ready

Recursively change strings with find and sed 

Just imagine that you have to change the word `cat` with `mouse` in hundreds of text files. It is unrealistic to do this manually - this can be accomplished with this simple shell command:

find ./ -type f -exec sed -i 's/string1/string2/g' {} \;


The first parameter is defining the location from where the find command will look recursively. If you're looking for a particular extension you can add -name '*.phps' for example.

In this example all files within the current and sub directories will be checked for 'string1' which will become 'string2'.

Clean and simple if you're trying to edit some hard-coded variable in multiple files across the system.


Comments - Recursively change strings with find and sed

Add Comment

Fill out the form below to add your own comments.









Insert Special:






Moderation is turned on for this blog. Your comment will require the administrators approval before it will be visible.


Tagged as: , , , , , ,

<<First <Back | 1 | 2 | 3 | 4 |