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
  • 331
  • 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
  • 254,755
  • 72
  • 386
  • 405
1
perl -pi -e 's/\/a\/b\/c/\/r\/s\/t/g' file_name
Vijay
  • 62,703
  • 87
  • 215
  • 314