I want to remove newline \n
only from end of the file in unix
e.g.
abc
def
ghi
output should be
abc
def
ghi
In the end of file there should not be a single \n
You can:
perl -pe 'chomp if eof' file1 > file2
Example:
$ cat file1
abc
def
ghi
$ perl -pe 'chomp if eof' file1 > file2
$ cat file2
abc
def
ghi$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With