sed remove empty lines at end of file code example Example: sed remove empty lines sed '/^$/d' /tmp/data.txt