perl -i.bak -nle"while ($empty) { --$empty; print '' } if (length()) { + print } else { ++$empty }" filename
For example,
will becomefoo CR LF bar CR LF CR LF CR LF
foo CR LF bar CR LF
In reply to Re: delete last CR and LF from txt
by ikegami
in thread delete last CR and LF from txt
by mph151
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |