Question

is just that i am trying to use sed and awk in a file to get columns, but i only get the first element of the column, i checked with cat and less and i found that all lines at the end have the ^Mnull character, i dont know what difference does it have with the null character, i only know it shows ^Mnull.

8%    |**                             |   978k 00:00:42 ETA^Mnull                  
10%   |***                            |  1229k 00:00:40 ETA^Mnull

How could i erase it in bash?

Thanks in advanced.

Était-ce utile?

La solution

Try this:

tr -d '\000\r' < yourfile > newfile

Notes:

The "-d" says to delete rather than transpose which is tr's normal modus operandi

The "\000" represents null.

The "\r" represents carriage return characters.

The order of the characters to delete is unimportant - they are just deleted.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top