[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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


Reply to: