2

Possible Duplicate:
Use slashes in sed replace

I need to find the following string /a/b/c and replace it with /r/s/t

It is a string and not a folder

/sam/pam/nancy --> /tim/cook/iphone

I am in the directory and just need to update multiple files having this line.

Community
  • 1
  • 1
Haran Murthy
  • 341
  • 2
  • 10
  • 30

2 Answers2

5

Use sed to change the files in-place. For example:

sed -i 's|/a/b/c|/r/s/t|g' *.txt
dogbane
  • 266,786
  • 75
  • 396
  • 414
1
perl -pi -e 's/\/a\/b\/c/\/r\/s\/t/g' file_name
Vijay
  • 65,327
  • 90
  • 227
  • 319