i am using the below perl command to remove the non ascii value,it is working fine.
we need to find the similar solution using the sed command. but i tried it is not working and getting the error.
perl -pe 's/[[:^ascii:]]//g' test.txt
sed is not working.
sed -i 's/[^[:ascii:]]//g' test.txt
Error:
sed: -e expression #1, char 17: Invalid character class name
ascii is not found in the wctype character classes, nor mentioned in e.g. man regex .
What characters do you want to remove? Strange locales'? Be aware that control chars 0x00 - 0x1F (including e.g. <TAB> ) are in the ascii set as well...
No. It will remove characters that are not in the "ASCII range" from 0x00 up to 0x7F . ASCII control chars (non- printable, incl. white space) will NOT be removed. It will remove characters above ASCII, starting with 0x80 (= 128), including "extended ASCII" or any other character set / encoding like UTF-8, on which your locale setting may depend.
You may want to consider starting over, making up your mind which chars you need, and which you don't, and rephrase your specification. Do you have examples of "target" chars ?