Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Sep 2008 10:14:08 -0400
From:      "Mark B." <mkbucc@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   How to delete non-ASCII chars in file
Message-ID:  <59f4cb420809050714i16ebe30bmd9f325592f05516e@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
I have a text file that includes some non-ASCII characters
For example, opening the file in vi shows lines like this:

 'easth_0.541716776378'      0   \xe2\x80\x98dire'       2

Is there a command-line tool I can use to delete these
characters?  I tried:

    cat f | tr -cd [:print:]

but this removes the newlines.

I also tried

   cat f | sed "s/[^:print:]//g"

but it didn't remove the characters.

Thanks,

m



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?59f4cb420809050714i16ebe30bmd9f325592f05516e>