[Linux-disciples] Deleting all non-ASCII characters

Jamie Forrest jamie at honksandsirens.com
Thu Jul 17 12:03:56 EDT 2008


On Jul 17, 2008, at 10:43 AM, Stephen R Laniel wrote:

> On Thu, Jul 17, 2008 at 10:37:40AM -0400, Stephen R Laniel wrote:
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>> while(<>) {
>>    s#[^[:ascii:]]##g;
>>    print;
>> }
>
> I believe that can actually be reduced
> to this one-liner:
>
> perl -n -e 's#[^[:ascii:]]##g' /path/to/file

Would it work to pipe the output of cat into that? So:

cat myfile | perl -n -e 's#[^[:ascii:]]##g

?


More information about the Linux-disciples mailing list