We have a file named as abc.txt and its a empty file. Due to some junk or control M characters, the file size is populated as 5 byte file. In order to have clean file we are using dos2unix command to remove the unknown character's. After using dso2unix command We can see the file size as 1 byte as it only contains a new line character .Can i know how to remove newline character if it is the only character in the entire file ?
Work Around :
cat abc.txt
cat -v abc.txt
M-oM-;M-?^M
ll abc.txt
-rw-r--r-- 1 ORAPRD ADMIN 5 Jan 25 07:08 abc.txt
dos2unix abc.txt
dos2unix: converting file abc.txt to Unix format ...
ll abc.txt
-rw-r--r-- 1 shpprd ADMIN 1 Jan 25 07:09 abc.txt
cat -v abc.txt
od -c abc.txt
0000000 \n
0000001
Does any one have solution for this?
Thank you.
> abc.txt
? what are result offile abc.txt
andod -c abc.txt
? – Archemar Jan 25 '19 at 13:19