- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- in vi how can I delete the ^M
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 04:55 PM
05-13-2004 04:55 PM
in vi how can I delete the ^M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 04:58 PM
05-13-2004 04:58 PM
Re: in vi how can I delete the ^M
To delete all the ^M. You need to the below.
:s/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 05:04 PM
05-13-2004 05:04 PM
Re: in vi how can I delete the ^M
As the ^M is a special character you need to type Ctrl key and V key together and Ctrl key and M key together.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 05:22 PM
05-13-2004 05:22 PM
Re: in vi how can I delete the ^M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 05:24 PM
05-13-2004 05:24 PM
Re: in vi how can I delete the ^M
$ dos2ux file1
See the man page for details, Using 'sed' will also work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 05:29 PM
05-13-2004 05:29 PM
Re: in vi how can I delete the ^M
perl -pne 's/chr(13)//;' filename > newfile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 05:34 PM
05-13-2004 05:34 PM
Re: in vi how can I delete the ^M
# dos2ux file_with_M | tee file_without_M
reverse is ux2dos ;-)
br Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 05:38 PM
05-13-2004 05:38 PM
Re: in vi how can I delete the ^M
either use the command:
# dos2ux
or
# vi
:1,s$/^M//
where ^M is holding down ctrl and press the key v and then m
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 05:45 PM
05-13-2004 05:45 PM
Re: in vi how can I delete the ^M
:1,$s/^M//
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 06:19 PM
05-13-2004 06:19 PM
Re: in vi how can I delete the ^M
:%s/^V^M//g
It comes out like this:
:%s/^M//g
This should fix your file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 06:33 PM
05-13-2004 06:33 PM
Re: in vi how can I delete the ^M
:g/CTRL-VM/s///g
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 07:56 PM
05-13-2004 07:56 PM
Re: in vi how can I delete the ^M
Yet another way:
tr -d '\r' < file-with-cr > file-nocr
JB.
_JB_
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2004 08:00 PM
05-13-2004 08:00 PM
Re: in vi how can I delete the ^M
:1,$s/.$//
(deletion off all last characters)
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 04:04 AM
05-17-2004 04:04 AM
Re: in vi how can I delete the ^M
:%!dos2ux
I find it very handy to pipe files or line ranges through various commands from inside of vi. The following on fixes indentation of C code.
:%!cb -s | expand -4 | unexpand
This entry in ~/.exrc makes vi fix line wrap and indentation for the current paragraph when I press function key one.
map #1 {!}exec adjust