Instead of creating a separate bgrep, it would have been better to be able to extend the syntax of regular expressions (in egrep, Perl and other platforms) to allow specification of binary strings having arbitrary length by means of an hex string.
This would come instead of making it very cumbersome to specify strings longer than one character (\xnn or \unnnn or equivalent - see also: http://www.regular-expressions.info/unicode.html). And if we are at it, it would have been nice to add to all R.E. engines hooks to allow private extensions of R.E. syntax, in order to allow people to concisely express special parsing requirements. --- Omer On Mon, 2015-07-20 at 21:24 +0300, Shachar Shemesh wrote: > On 20/07/15 11:56, 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 > > > http://debugmo.de/2009/04/bgrep-a-binary-grep/ -- What happens if one mixes together evolution with time travel to the past? See: http://www.zak.co.il/a/stuff/opinions/eng/evol_tm.html My own blog is at http://www.zak.co.il/tddpirate/ My opinions, as expressed in this E-mail message, are mine alone. They do not represent the official policy of any organization with which I may be affiliated in any way. WARNING TO SPAMMERS: at http://www.zak.co.il/spamwarning.html _______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il