Pages

Tuesday, 7 August 2012

Find And Replace.[Linux]

We can simply find and replace the string of the file with the new one.

1. Go to the path were you want to search for the files which are using the corresponding string

cd /path/to/the/directory

2.Then do the search :-

grep -iRl string ./*

the above command will search out all the files using the string "string".

3.Replace all :-

Then enter into each file then run the below command.

::%s/oldstring/newstring/g

thet will replace all the old string to new one.

Done !

No comments:

Post a Comment