What is the best way to output all lines of a file without the last line using command line tools?
Example:
$ cat foo.txt abc vwxyz a sd dsgdfg $ some-cmd foo.txt abc vwxyz
BASH using head :
head
$ head --lines=-1 filename
Same thing for Mac:
expr "$a" : '\(.*\) '
A new line is required!
Probably the shortest way:
sed '$d' filename