<div dir="ltr"><div><div><div>Hi,<br></div>Possibly using "strings file_name >new_file_name" command could resolve this problem.<br></div>Thank you.<br></div>Alex<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 20, 2015 at 9:46 PM, Omer Zak <span dir="ltr"><<a href="mailto:w1@zak.co.il" target="_blank">w1@zak.co.il</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Instead of creating a separate bgrep, it would have been better to be<br>
able to extend the syntax of regular expressions (in egrep, Perl and<br>
other platforms) to allow specification of binary strings having<br>
arbitrary length by means of an hex string.<br>
<br>
This would come instead of making it very cumbersome to specify strings<br>
longer than one character (\xnn or \unnnn or equivalent - see also:<br>
<a href="http://www.regular-expressions.info/unicode.html" rel="noreferrer" target="_blank">http://www.regular-expressions.info/unicode.html</a>).<br>
<br>
And if we are at it, it would have been nice to add to all R.E. engines<br>
hooks to allow private extensions of R.E. syntax, in order to allow<br>
people to concisely express special parsing requirements.<br>
<br>
--- Omer<br>
<br>
<br>
On Mon, 2015-07-20 at 21:24 +0300, Shachar Shemesh wrote:<br>
> On 20/07/15 11:56, Orna Agmon Ben-Yehuda wrote:<br>
><br>
> > Hello everyone,<br>
> ><br>
> ><br>
> > I often have damaged text files (due to a lovely storage system).<br>
> > The files are of different formats, although I can usually assume<br>
> > they contain spaces. The files are structured as lines.<br>
> ><br>
> ><br>
> > Every once in a while, the lovely destruction (ahm....storage)<br>
> > system inserts binary garbage to the file. I wish to fix the files<br>
> > by removing the cancer without leaving any leftovers. That is, I<br>
> > want to lose partial lines.<br>
> ><br>
> ><br>
> > I tried using grep with all sorts of keys, but it did not do the<br>
> > trick.<br>
> > strings catches too little - it leaves partial lines.<br>
> > Is there an elegant way to do the trick line-wise?<br>
> ><br>
> ><br>
> > Thanks<br>
> > Orna<br>
> ><br>
> <a href="http://debugmo.de/2009/04/bgrep-a-binary-grep/" rel="noreferrer" target="_blank">http://debugmo.de/2009/04/bgrep-a-binary-grep/</a><br>
--<br>
What happens if one mixes together evolution with time travel to the<br>
past? See: <a href="http://www.zak.co.il/a/stuff/opinions/eng/evol_tm.html" rel="noreferrer" target="_blank">http://www.zak.co.il/a/stuff/opinions/eng/evol_tm.html</a><br>
My own blog is at <a href="http://www.zak.co.il/tddpirate/" rel="noreferrer" target="_blank">http://www.zak.co.il/tddpirate/</a><br>
<br>
My opinions, as expressed in this E-mail message, are mine alone.<br>
They do not represent the official policy of any organization with which<br>
I may be affiliated in any way.<br>
WARNING TO SPAMMERS: at <a href="http://www.zak.co.il/spamwarning.html" rel="noreferrer" target="_blank">http://www.zak.co.il/spamwarning.html</a><br>
<br>
<br>
_______________________________________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" rel="noreferrer" target="_blank">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
</blockquote></div><br></div>