Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to remove <0d> with vim?

1,300 views
Skip to first unread message

wing

unread,
Jan 4, 2003, 11:11:45 AM1/4/03
to
Hi,

I have downloaded a file from Unix and try to edit it in windows with
vim. However, the new line charachers for unix is not the same as
that of windows.

In windows vim, i see the character <0d>. How to remove it with one
command in vim?

I have tried to search the character with /^V13 and /^x0d but fails.

Thanks in advance for any ideas and inputs.

Wing

Mike Hunter

unread,
Jan 4, 2003, 12:08:18 PM1/4/03
to

I think 0d is 13 which is \r. But it sounds like you might have a
macintosh file; unix uses only 0a (10 or \n).

Mike

Tim Roberts

unread,
Jan 5, 2003, 12:16:24 AM1/5/03
to
wing...@witty.com (wing) wrote:

>Hi,
>
>I have downloaded a file from Unix and try to edit it in windows with
>vim. However, the new line charachers for unix is not the same as
>that of windows.

Yes, but vim can change that. If you edit a Unix file (LF only) and you
want to change it to a Windows file (CR-LF), use

:set fileformat=dos

>In windows vim, i see the character <0d>. How to remove it with one
>command in vim?

To remove all extra carriage returns:

:%s/^V^M//g

(That's ctrl-V ctrl-M).

In vim 6.x with the Windows cut-and-paste keys turned on, use Ctrl-Q
instead of Ctrl-V.
--
- Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

zzapper

unread,
Jan 5, 2003, 5:54:43 AM1/5/03
to
wing...@witty.com (wing) wrote in message news:<873e96d6.03010...@posting.google.com>...
> Hi,
>

>
> In windows vim, i see the character <0d>. How to remove it with one
> command in vim?

The Vim Way

:%s/\r//g

--
zzapper

vim -c ":%s/^/WhfgTNabgureRIvzSUnpxre/|:%s/[R-T]/ /Ig|:normal ggVGg?"

http://www.vim.org/tip_view.php?tip_id=305 Best of Vim Tips

0 new messages