Grepping Unicode files?

Václav Haisman vhaisman@gmail.com
Thu May 14 16:14:00 GMT 2015


On 14.5.2015 17:42, Vince Rice wrote:
> uname says "CYGWIN_NT-6.1 machinename 1.7.35(0.287/5/3) 2015-03-04
> 12:07 i686 Cygwin”. I’m running grep 2.21.2, which cygcheck -c says
> is OK.
> 
> Does Cygwin’s grep support Unicode files? The output from a SQL
> Server SQL Agent job is a Unicode file, i.e. if you look at it in a
> hex editor every other character is 00 because each character is
> taking up two bytes. The filename itself is fine, it’s the contents
> that is Unicode. I can’t get grep to work on it, either with or
> without -a.

That sounds like UTF-16. Have you tried funneling it through `iconv` first?

> 
> This may not be a Cygwin-specific question, but I haven’t been able
> to find anything after several Google searches, including the
> archives, and neither --help nor the man page for grep references
> Unicode.
> 
> By default I have neither LC_ALL nor LC_COLLATE set.
> 
> A pointer to a better search or a website that explains this would be
> great, or if it can’t currently be done, that’s OK, too.
> 

-- 
VH

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150514/2c8b528a/attachment.sig>


More information about the Cygwin mailing list