I have TXT files[2000] to process but they contain the degree symbols in them due to which the processing program fails on these files. I want a unix command that will remove the degree symbols from these files.
I tried using the sed command: sed 's/[!@#\$%^�&*()]//g' filename but it did not work. This issue requires immediate attention at my end, any help on this would be highly appreciated.
I tried /usr/bin/perl -i -pe 's/[^\u2103]//g' file.txt > newfile.txt -- It gave an empty newfile.txt and the content of file.txt got changed to the name of it.
sed -e 's/\�//g' -- did not replace the degree symbol either.
PS : The degree symbol is visible only when I select the Show/Hide button on MS Word other wise it doesn't appear. Files with this symbol are not getting processed.
Your command -> iconv -c -f UTF8 -t ASCII source.txt > output.txt.out and tr -d '\200-\377' <file.txt >file.txt.out to remove degree symbol worked fine, I also want to know if we can replace that character with a space as the required space between the two words got removed at the position degree symbol got converted. Thanks a lot for all the help till now on this. Looking forward for your answer on this remaining piece as well. Thanks!
In that bracketed expression, every single backslash intended as an escape sequence is absolutely unnecessary. Not only are the characters following the backslashes not special when in a bracketed expresion, neither is the backslash itself.
The repeated use of | is probably intended as an alternation operation, but since the pipe symbol is not special in this context, it is unintentionally added to the list of matched characters.
The short version: There's almost nothing special within bracketed expressions, except for ] , ^ (only if it occurs as the first character), and an embedded - (in the POSIX locale, used for range expressions).
Assuming I understood your intent (which is not a foregone conclusion), the following is a corrected version of what you suggested: