Home > Technology > Recursive Find & Replace

Recursive Find & Replace

grep -rl string1 dirname | xargs sed -i ‘s/string1/string2/’

this command just replace string1 in all file (nested or not ) in directory dirname with string2. I think it may be helpful to replace the cvs id of one user with cvs id of another.

For example i used this command to replace all occurence of hasan_rakibul into prosunjit_biswas

grep -rl hasan_rakibul ObjRunSrv/ | xargs sed -i ‘s/hasan_rakibul/prosunjit_biswas/’

Categories: Technology
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: