|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Re: Replacing non ascii in stringby vinoth.ree (Priest) |
| on Jan 30, 2013 at 04:41 UTC ( #1015958=note: print w/ replies, xml ) | Need Help?? |
|
This will remove the non ascii characters,also creates backup file in file.backup file. You can do the job with a perl one liner: perl -i.backup -pe 's/[[:^ascii:]]//g;' file Also, $str =~ s/[^!-~\s]//g; In the above, !-~ is a range which matches all characters between ! and ~. The range is set between ! and ~ because these are the first and last characters in the ASCII table.This does not include whitespace, so i added \s also.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||