This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Using cat, head, tail on binary files
- From: Erik Sobel <erik dot sobel at alphatech dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 27 Nov 2001 10:16:32 -0500
- Subject: Using cat, head, tail on binary files
What is the trick to getting cat, head, and tail to work correctly with
binary files under WinNT? I tried setting the CYGWIN environment variable
to "binmode" as recommended by the documentation. This got things closer
to working but it's still not right.
Example: given a binary file named foo of size 10000 bytes
CYGWIN=tty
head -c50 foo > foo.part1 # got 23 bytes from foo
tail -c1000 foo > foo.part2 # got 648 bytes from foo
cat foo.part1 foo.part2 > new_foo # is not the sum of the two input file sizes
CYGWIN=binmode
head -c50 foo > foo.part1 # got 58 bytes from foo
tail -c1000 foo > foo.part2 # got 1046 bytes from foo
cat foo.part1 foo.part2 > new_foo # is not the sum of the two input file sizes
cat foo foo > foo2 # is not twice the size of foo
Any suggestions would be appreciated.
Thanks,
Erik
----------------------------------------------------------------------------------------------------------
Erik Sobel
esobel@alphatech.com
----------------------------------------------------------------------------------------------------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/