tr does what strings does - clears only the characters, not the full bad line. Not what I wanted. but now that I know what data I have there, I can clear it using any script (back to Dov's solution).
Thanks everyone! On Tue, Jul 21, 2015 at 2:20 AM, Amos Shapira <amos.shap...@gmail.com> wrote: > +1 for "tr -d '\0' < file > newfile", based on the updated description. > But "prevention is better than a cure" - find a way to avoid this in the > first place. > > On 21 July 2015 at 07:22, Boruch Baum <boruch_b...@gmx.com> wrote: > >> I see that I'm late to the discussion and that your original problem has >> morphed a bit. Maybe the simplest and oldest solution is the `tr -d' >> command. See `man tr'. >> >> On 07/20/2015 04:56 AM, Orna Agmon Ben-Yehuda wrote: >> > Hello everyone, >> > >> > I often have damaged text files (due to a lovely storage system). The >> files >> > are of different formats, although I can usually assume they contain >> > spaces. The files are structured as lines. >> > >> > Every once in a while, the lovely destruction (ahm....storage) system >> > inserts binary garbage to the file. I wish to fix the files by removing >> the >> > cancer without leaving any leftovers. That is, I want to lose partial >> lines. >> > >> > I tried using grep with all sorts of keys, but it did not do the trick. >> > strings catches too little - it leaves partial lines. >> > Is there an elegant way to do the trick line-wise? >> > >> > Thanks >> > Orna >> > >> > >> > >> > _______________________________________________ >> > Linux-il mailing list >> > Linux-il@cs.huji.ac.il >> > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il >> > >> >> >> -- >> hkp://keys.gnupg.net >> CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0 >> >> >> _______________________________________________ >> Linux-il mailing list >> Linux-il@cs.huji.ac.il >> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il >> > > > > -- > <http://au.linkedin.com/in/gliderflyer> > > _______________________________________________ > Linux-il mailing list > Linux-il@cs.huji.ac.il > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il > > -- Orna Agmon Ben-Yehuda. http://ladypine.org
_______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il