Skip to main content

Raymii.org Raymii.org Logo

אֶשָּׂא עֵינַי אֶל־הֶהָרִים מֵאַיִן יָבֹא עֶזְרִֽי׃
Home | About | All pages | Cluster Status | RSS Feed

Strip all non-ascii characters from a file

Published: 27-06-2013 | Author: Remy van Elst | Text only version of this article


❗ This post is over twelve years old. It may no longer be up to date. Opinions may have changed.

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 , snippets , utf-8