Remove non-ASCII characters from CSV
Solution 1:
A perl oneliner would do: perl -i.bak -pe 's/[^[:ascii:]]//g' <your file>
-i
says that the file is going to be edited inplace, and the backup is going to be saved with extension .bak
.
Solution 2:
# -i (inplace)
sed -i 's/[\d128-\d255]//g' FILENAME
Solution 3:
I tried all the solutions and nothing worked. The following, however, does:
tr -cd '\11\12\15\40-\176'
Which I found here:
https://alvinalexander.com/blog/post/linux-unix/how-remove-non-printable-ascii-characters-file-unix
My problem needed it in a series of piped programs, not directly from a file, so modify as needed.
Solution 4:
sed -i 's/[^[:print:]]//' FILENAME
Also, this acts like dos2unix