New answers tagged binary
tr and grep are text processing tools. They expect their input to be text files. Computers store data as sequences of bytes. A text is a sequence of characters. There are several ways to encode characters as bytes, called character encodings. The de facto standard character encoding in most of the world, especially on OSX, is UTF-8, which is an encoding for ...
I suppose that your charmap from the locales is UTF-8, so that you'll have problems on binary files. Just switch to C locale: LC_ALL=C tr '\r' '\n' < target-file | LC_ALL=C grep search-string
You could write your own in Lisp http://www.gigamonkeys.com/book/practical-parsing-binary-files.html
Top 50 recent answers are included