This tip is for my friend Scarb. For years I’ve used the Linux command “tail -f” for watching logs… but only recently did I discover its versatility for extracting parts of files.
Need to grab only the last 25 lines of a file?
tail -n 25 somefile.txt
How about the last 200000 bytes redirected to another file?
tail -c 200000 somefile.txt > newfile.txt
2 thoughts on “Using Linux Tail to Trim Your Files”
I don’t know how I ever got by without this information — thanks PixelGeek!
I came across multitail (http://www.vanheusden.com/multitail/), loved it.