On 06/20/2012 07:42 AM, Gary Aderhold wrote: > I'm using GNU grep 2.5.4. I'm grepping a binary file in Windows that > has record delimiters of CRLF (x'0D 0A'). My grep selects the proper > rows, but, when sending the results to a file, it's adding a CR to the > end of each record. So, now my records all end with x'0D 0D 0A'.
That sounds like a case of your version of grep opening input files in binary mode, but output files in text mode. Either grep should open ALL files in binary mode, or ALL files in text mode (and I prefer binary mode, as it is less likely to strip CR when I want it preserved). But this is not a bug in upstream grep. > > Is this a bug? Or, is there a way to tell grep to NOT add this extra > x'0D' byte? You'll need to investigate this with whoever made the particular grep binary for windows, and figure out why their port is mixing binary and text modes. They may have also provided a --binary command-line option, and if using that option fixes your problems, you have a workaround. -- Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
