Using Linux Tail to Trim Your Files

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

Leave a Reply

Your email address will not be published. Required fields are marked *