Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

TexPad is creating it. I know that it is under some deadkey. I just cannot remember it is name.

The blue character:

enter image description here

I just want to mass remove them from my document.

How can you type it?

share|improve this question

2 Answers 2

up vote 12 down vote accepted

It is known as carriage return.

If you're using vim you can enter insert mode and type CTRL-v CTRL-m. That ^M is the keyboard equivalent to \r.

Inserting 0x0D in a hex editor will do the task.

How to remove?

You can remove it using the command perl -p -i -e "s/\r//g" filename.

As the OP suggested in the comments of this answer here, you can even try a dos2unix filename and see if that fixes it.

As @steeldriver suggests in the comments, after opening the vim editor, press esc key and type :set ff=unix.

References

http://stackoverflow.com/questions/1585449/insert-the-carriage-return-character-in-vim

http://stackoverflow.com/a/7742437/1742825

not found [No such file or directory] error on Linux machine

share|improve this answer
2  
it might be worth mentioning vi/vim :set ff=unix as well –  steeldriver Jun 5 at 17:27
    
@steeldriver, done :) –  Ramesh Jun 5 at 17:29
    
Thank you for your answer! –  Masi Jun 5 at 17:32
    
@Masi, you are welcome :) –  Ramesh Jun 5 at 17:33
1  
@mikeserv, use <kbd> key </kbd> to use the keyboard symbols. :) –  Ramesh Jun 6 at 0:31

As Ramesh notes, CTRL+V CTRL+M should get you the literal character - though you're not limited to doing this only in vim - you should be able to do the same on any canonical mode tty.

cat ./file | tr -d '\r' >./file

...might do the job.

share|improve this answer
    
you're reading from and writing to the same file, would this not cause a problem –  1_CR Jun 5 at 19:20
    
@1_CR Im reading from the |pipe file. Its true, an intermediate tmp file would be more robust - but the buffer in the pipe should be enough. Still, in case it isnt, tr -d '\r' <<FILE >./file\n$(cat ./file)\nFILE\n would be a sure thing - provided the file contains no \000 characters, that is. –  mikeserv Jun 5 at 19:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.