====== AWK - Delete trailing whitespace and tabs from the end of each line ====== awk '{ sub(/[ \t]+$/, ""); print }' file.txt ---- ===== Example ===== aaaaa bbbbb ccccc ddddd eeeee returns: aaaaa bbbbb ccccc ddddd eeeee