[sf-lug] I need a quick piece of code..

jim jim at well.com
Thu Dec 31 13:02:07 PST 2009



hmmm. 

tail -1 filename 

tail -n 1 filename 

tail --lines=1 filename 

so many choices. i wonder why. 

   also, tho' neither the --help nor the man page 
mentions it, tail -1 (or any other number) works. 

   even more also: for the first time i've noticed 
that tail has a -c option that claims to dump the 
last so many bytes of a file
$ tail -c 7 filename 
$ echo "hey, wow, things are better" | tail -c 9 
e better
$ 
(probably good for fully binary files, as newline 
seems not respected) 
$ echo "abc wxyz
gosh" | tail -c 9 
xyz
gosh
$ 

   and yet more: tail has a -q option, for quiet. say 
what? the -q option, according to --help and the man 
page, suppresses output of headers. 
   note the -c and the -q options exist for the head 
command, too. 




On Thu, 2009-12-31 at 12:22 -0800, Rick Moen wrote:
> Quoting Jim Stockford (jim at well.com):
> 
> > so what'd you think so far, john? 
> 
> Well, he wrote me offlist to say that 'tail -n 1 [filename]' 
> suffices to solve his problem.
> 
> 
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug
> Information about SF-LUG is at http://www.sf-lug.org/
> 





More information about the sf-lug mailing list