From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32025 invoked by alias); 27 Nov 2001 15:33:40 -0000 Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@sources.redhat.com Received: (qmail 31982 invoked from network); 27 Nov 2001 15:33:35 -0000 Received: from unknown (HELO tao.ik.ca) (216.138.212.10) by hostedprojects.ges.redhat.com with SMTP; 27 Nov 2001 15:33:35 -0000 Received: (qmail 28662 invoked from network); 27 Nov 2001 15:37:38 -0000 Received: from apastourelles-101-1-4-169.abo.wanadoo.fr (HELO neo) (193.253.204.169) by 0 with SMTP; 27 Nov 2001 15:37:38 -0000 Message-ID: <00f401c17759$708343d0$0200000a@dyn.ik.ca> From: "Gerald Villemure" To: , "Erik Sobel" References: <4.3.2.7.2.20011127095652.00b92960@mail.alphatech.com> Subject: Re: Using cat, head, tail on binary files Date: Fri, 16 Nov 2001 15:29:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SW-Source: 2001-11/txt/msg01061.txt.bz2 Use the dd command to work with binary files. For example: dd if=foo of=foo.part1 bs=1kD count=10 This will create a file called 'foo.part1' with the first 10000 bytes If you want part2 one way is: dd if=foo of=foo.part2 bs=1kD skip=10 Hope this helps Gerald ----- Original Message ----- From: "Erik Sobel" To: Sent: Tuesday, November 27, 2001 4:16 PM 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/ From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Gerald Villemure" To: , "Erik Sobel" Subject: Re: Using cat, head, tail on binary files Date: Tue, 27 Nov 2001 07:33:00 -0000 Message-ID: <00f401c17759$708343d0$0200000a@dyn.ik.ca> References: <4.3.2.7.2.20011127095652.00b92960@mail.alphatech.com> X-SW-Source: 2001-11/msg01649.html Message-ID: <20011127073300.eQftgmyCnBfUNx1kQ8TKOccgmC5z4ye8VDXoPwhIE94@z> Use the dd command to work with binary files. For example: dd if=foo of=foo.part1 bs=1kD count=10 This will create a file called 'foo.part1' with the first 10000 bytes If you want part2 one way is: dd if=foo of=foo.part2 bs=1kD skip=10 Hope this helps Gerald ----- Original Message ----- From: "Erik Sobel" To: Sent: Tuesday, November 27, 2001 4:16 PM 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/