1

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.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
  • The linked question is about a file which is opened in VIM. VIM is interactive, so the answers in the linked question don't apply here. – oberlies Mar 05 '14 at 11:39

1 Answers1

2

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.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • Hi, thanks for the answer, but it is not working, i still get ^Mnull at the end, and because of that, awk only shows the first element of the column i need, not the complete column. i dont know what else to do to erase it. – user3186133 Jan 30 '14 at 15:23
  • Try using "tr" as per edit. – Mark Setchell Jan 30 '14 at 15:28