Say you have a file named test.txt
with the following lines:
ಕದಂಬ
कदम्ब
Then, suppose you want to replace each devanagarI unicode character (ie in कदम्ब) with a D. Then, you might think that the following would work:
find . -name 'test.*' | xargs perl -w -i -p -e 's/(\p{Devanagari})/D/g'
But it doesn't. How to accomplish this?
Best Answer
As suggested by steeldriver, you can force both STDIN/STDOUT to be UTF-8:
Will transform your sample file like this:
Source: http://perldoc.perl.org/perlrun.html#Command-Switches