0

I have many .js files named the same (got.js) where i just need to find and replace some text on them. The text to find is: \x72\x6Fx75\x6E
And is to be replaced with: \x72\x6F\x75\x6E (just a \ in the middle)
I have tried SED with find, exactly this one:
find '/home/' -name 'got.js' -exec sed -i -e 's%\x72\x6Fx75\x6E%\x72\x6F\x75\x6E%g' '{}' %; but i get an error find: missing argument to '-exec'. If i change % to \, it don't show any error, files last modified date changes, but nothing changes on the files.
Also, i should mention that this \x72\x6Fx75\x6E text is part of a big encoded phrase. I thought that this may be the problem, and putted the whole phrase in the sed, but the result was the same: nothing changes :-(
Hope that someone can help me on this.
Thanks to everyone!

Kleidi
  • 15
  • 6

1 Answers1

0

Try this:

find '/home/' -name 'got.js' -exec sed -i -e 's/\\x72\\x6Fx75\\x6E/\\x72\\x6F\\x75\\x6E/g' {} \;

Edit: was a typo error on the original command line. 2 single quotes after ../g

gWaldo
  • 11,887
  • 8
  • 41
  • 68
drookie
  • 8,051
  • 1
  • 17
  • 27
  • Thank you very much @drookie. It did the trick. As i'm seeing, my problem was the escaping and delimitation :-( At your example, every \ should be escaped with another \ . Will try it in another complex way and let you know if anything goes wrong.
    Thanks again!
    – Kleidi Jan 26 '16 at 14:38