[Nottingham] [Talk] ***TODAY*** Wed 19/10/2005 Voice over IP {ML}

Robert Hart enxrah at nottingham.ac.uk
Wed Oct 19 17:17:26 BST 2005


On Wed, 2005-10-19 at 16:49 +0100, Michael Erskine wrote:
> On Wednesday 19 October 2005 16:38, Robert Hart wrote:
> > What if you want all but the last 10 lines of a file? That
> > should be head +10 by my logic?
> 
> That's what tail is for :)
> 

No it's not. Try this:

seq 1 20 > tmp.txt
head -2 tmp.txt
tail -2 tmp.txt
tail +2 tmp.txt
head +2 tmp.txt    #this doesn't do what you think it does.
head -$((`wc -l<tmp.txt`-2)) tmp.txt  #but this does.

See what I mean? 

-- 
Robert Hart <enxrah at nottingham.ac.uk>
University of Nottingham


This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.




More information about the Nottingham mailing list