What is the best way to output all lines of a file without the last line, using command-line tools?
Example:
$ cat foo.txt
a b c
v w x y z
a sd dsgdfg
$ some-cmd foo.txt
a b c
v w x y z
BASH, using head
:
$ head --lines=-1 filename
Same for Mac:
expr "$a" : '\(.*\)
'
The newline is required!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With