1

I have a script where I am reading a file in hash and using one of the values as a search $find = "pqr" and trying to replace with a directory structure $replace = "/abc/xyz/bcd"

/usr/bin/perl -0777 -pi -e 's/$find/$replace/' $file

This doesn't work, I tried using "" quotes - no success

Please let me know if there some quick suggestion

choroba
  • 19,261
  • 4
  • 49
  • 52
Guestme
  • 11
  • 1

1 Answers1

1

If your $replace contains slashes, use a different separator (and double quotes):

"s%$find%$replace%"
choroba
  • 19,261
  • 4
  • 49
  • 52