Remove lines that contain non-english (Ascii) characters from a file

前端 未结 4 2098
我在风中等你
我在风中等你 2021-02-13 02:48

I have a text file with characters from different languages like (chinese, latin etc)

I want to remove all lines that contain these non-English characters. I want to inc

4条回答
  •  执念已碎
    2021-02-13 03:28

    Perl supports an [:ascii:] character class.

    perl -nle 'print if m{^[[:ascii:]]+$}' inputfile
    

提交回复
热议问题