sed delete 3 lines code example Example: sed remove last 3 lines head -n -1 file.txt #Use negative numbers after flag for last lines