in reply to Removing Non-Ascii chars from text file

You can do the job with a perl one-liner:

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

This will remove all non ascii character from your file copying the original content in file.bk

citromatik

Replies are listed 'Best First'.
Re^2: Removing Non-Ascii chars from text file
by freonpsandoz (Beadle) on Oct 02, 2016 at 05:06 UTC

    You also need to be aware of what the encoding of the file is and what encoding Perl defaults to on your system. For a UTF-8 file on Windows, I found that I needed to add "use open qw(:std :utf8);" before the "s///" command so that Perl would expect the input to be UTF-8.

Re^2: Removing Non-Ascii chars from text file
by Anonymous Monk on Aug 04, 2015 at 08:22 UTC
    You've made my day :) busy with csv parsing and couldn't get rid of " € 1.000 " from one of the fields
      Sounds more like wrong encoding, though.
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^2: Removing Non-Ascii chars from text file
by Anonymous Monk on Jul 08, 2016 at 12:15 UTC
    This works. I just don't want the backup file. How to do that.

      See perlrun on what the switches do. For your case especially relevant is the -i switch, which takes an optional parameter.