Re: reading the end of file
On Fri, Jul 24, 2009 at 12:37:51AM -0500, Ron Johnson wrote: On 2009-07-23 01:45, Ekkard Gerlach wrote: * Francesco Pietra schrieb: Hi: Is any command faster than cat filename to reach and print on screen the last page of the file? what kind of file? tail -n 10 filename makes output of last 10 lines of a file. But if there are no linefeeds/ carriage return in the files, the it makes no sense. tac filename filename_taced Hey, cool. I never knew that... turns around a file, the end becomes the beginning. head -n 10 filename_taced | tac Why use an intermediary file instead of a pipe? $ tac filename | head -n10 Well in some cases it makes a difference. tail operating on a file can read the file form the end rather than reading the whole file, while with the pipe it has no choice but to receive all the data and then return the last bit of it. -- Len Sorensen -- To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Re: reading the end of file
* Francesco Pietra schrieb: Hi: Is any command faster than cat filename to reach and print on screen the last page of the file? what kind of file? tail -n 10 filename makes output of last 10 lines of a file. But if there are no linefeeds/ carriage return in the files, the it makes no sense. tac filename filename_taced turns around a file, the end becomes the beginning. head -n 10 filename_taced | tac prints out the last 10 lines of filename, maybe faster with huge files. If you want to give out last 100 chars: tac filename | cut -c 1-100 | tac maybe cut counting starts with zero (cut -c 0-99) Ekkard -- To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Re: reading the end of file
Francesco Pietra wrote: Hi: Is any command faster than cat filename to reach and print on screen the last page of the file? Define 'page'. Anyway, the command you want is 'tail'. By default it prints the last 10 lines, but this can be changed, see the man page. The question (i hope) is not outside amd64 As a matter of fact it is not amd64-specific, debian-user would have been more appropriate. as such large files as 10GB can only result from computations at 64 bit. As long as the filesystem supports, it's trivial to create a 10GB file even on 32-bit systems. But I digress. -- The New England Journal of Medicine reports that 9 out of 10 doctors agree that 1 out of 10 doctors is an idiot. Eduardo M KALINOWSKI edua...@kalinowski.com.br -- To UNSUBSCRIBE, email to debian-amd64-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org