Strip all non-ascii characters from a file

27-06-2013 | Remy van Elst


Table of Contents


This snippet strips all non-ascii characters from a file. It backs up the original file. This is handy if you have input for programs that bork on non-ascii input like older mainframes and such.

perl -i.bk -pe 's/[^[:ascii:]]//g;' filename

Tags: ascii, perl, utf-8,