Please help!!!!!!!!!

1 view
Skip to first unread message

Vim Questions

unread,
Dec 16, 2008, 4:10:30 PM12/16/08
to vim...@googlegroups.com
Hello
I need to remove carriage return (Char 13) from a text. Was adviced to use Vim. (MS-Windows).
 
But can not inderstand how to do it.
I loaded the text, "select all" and put ":list" in the end. It shows all the hidden characters and does not allow to edit/remove them. They disapper whenever I move the mouth.
 
Please help !  
 
All the best, L

John Beckett

unread,
Dec 16, 2008, 8:11:23 PM12/16/08
to vim...@googlegroups.com
Vim Questions wrote:
> I need to remove carriage return (Char 13) from a text.
> Was adviced to use Vim. (MS-Windows).

In normal mode (after pressing Escape), enter command:

:%s/\r//g

That will remove all CR characters. See:
http://vim.wikia.com/wiki/Change_end-of-line_format_for_dos-mac-unix

For the future, please:

- Use a suitable subject ("Remove carriage return").
If you can't think of a subject, don't send a question.

- Consider using a suitable name.
Why would anyone want to reply to "Vim Questions"?

John

Tony Mechelynck

unread,
Dec 16, 2008, 8:19:15 PM12/16/08
to vim...@googlegroups.com

You can either use the special-purpose dos2unix utility or do the following:

1. Load Vim (don't yet specify an editfile).

2. Read the file, accepting either CR+LF or LF alone (or any mixture of
them) as an end-of-line marker
:e ++ff=dos filename.txt

3. Write the file, outputting only LF (without CR) at the end of each line
:setlocal ff=unix
:w

4. (Optional, if you don't need Vim any longer)
:q

The above assumes Vim 7.2.040 or later. With earlier versions it's
possible but not as simple.


Also:
- To learn how to use Vim, run the Vim tutor.
- Next time, please use a more specific Subject line. See
http://www.catb.org/~esr/faqs/smart-questions.html about how to increase
the likelihood that your questions will be answered.


Best regards,
Tony.
--
Proverb: A nightingale that forgets the lyrics is a hummingbird.

Reply all
Reply to author
Forward
0 new messages