Cat and Head Problems with Binary Files

$Bill Luebkert dbe@wgn.net
Sat Jul 31 18:34:00 GMT 1999


Jeffry T Ross wrote:
> 
> Who ever said that cat and head are textutils?
> On the Unix side of the world they're commonly used
> on binary files.  If you have a 10gig file of binary
> data, what the easiest way to get a 10k chunk?
> 
> How about: head -c 10000 bigfile > littlefile
> 
> This works in Unix because Unix thinks all files are
> binary, and that's because all files are binary.  The
> notion of text files is a bogus limitation imposed by
> Microsoft.
> 
> Is there a reason why having cat treat all files as binary
> would cause erroneous performance when cat was used on a
> file you'd consider to be text?

I have a slightly different opinion:

I could just as easily say that cat and text are text utils since 
they operate on text files (even extended 8-bit character text files
which one could call binary).  There is such a thing as 8-bit text.

The point is, on UNIX files are strings of bytes, not binary and not text, 
just a bunch of 8-bit characters strung together in a file.  UNIX doesn't 
care if those bytes are 'Text" or 'Binary' after all, they are/could be both.

A byte is a byte, of course of course, unless of course the byte is 
really two little-endian nybbles. :)

-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   http://www.wgn.net/~dbe/
  / ) /--<  o // //      Mailto:dbe@wgn.net   http://dbecoll.webjump.com/
-/-' /___/_<_</_</_    http://www.freeyellow.com/members/dbecoll/

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list