Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

findstr or grep that autodetects chararacter encoding (UTF-16)

I want to do this:

 findstr /s /c:some-symbol *

or the grep equivalent

 grep -R some-symbol *

but I need the utility to autodetect files encoded in UTF-16 (and friends) and search them appropriately. My files even have the byte-ordering mark FFEE in them so I'm not even looking for heroic autodetection.

Any suggestions?


I'm referring to Windows Vista and XP.

like image 810
David Martin Avatar asked Jan 02 '09 21:01

David Martin


1 Answers

findstr /s /c:some-symbol *

can be replaced with the following character encoding aware command:

for /r %f in (*) do @find /i /n "some-symbol" "%f"
like image 193
Shameer Avatar answered Oct 15 '22 16:10

Shameer