Re[2]: reading the end of file

2009-07-24 Thread Bogdan
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

this would be more readable in the case of a plain-text file:

$ tac filename.txt | head -n 10 | tac

and yes, that's cool :)

-- реклама ---
http://FREEhost.com.ua - еще больше места и возможностей.
При заказе хостинга - домен бесплатно.


--
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

2009-07-24 Thread Lennart Sorensen
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

2009-07-23 Thread Ekkard Gerlach
* 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



reading the end of file

2009-07-22 Thread Francesco Pietra
Hi:

Is any command faster than

cat filename

to reach and print on screen the last page of the file?

The question (i hope) is not outside amd64 as such large files as 10GB
can only result from computations at 64 bit. The scope is following
the progress of the computational procedure; the command cat
filename takes hours to print the end of the file. At least so when
all memory (24GB) is taken by the diagonalization of matrix, while the
hamiltonian is stored out of memory (10GB).

thanks
francesco pietra


-- 
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

2009-07-22 Thread Eduardo M KALINOWSKI
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