- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Remove ^M from shell
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
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
01-09-2008 02:50 AM
01-09-2008 02:50 AM
i'v upload the nickel in my servers from windows machine.
but it shows ^M in every line. how can i remove this with command?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 02:56 AM
01-09-2008 02:56 AM
Re: Remove ^M from shell
check the command: dos2ux
or search in this forum, you will find a lot of topics.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 03:01 AM
01-09-2008 03:01 AM
Solution1) You have made a mistake with ascii/binary in your ftp transfer. The windows ftp client defaults to ascii which probably caused this.
2) dos2unix normally fixes this problem, but you may also have to do the download/uplaod over again properly.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 03:05 AM
01-09-2008 03:05 AM
Re: Remove ^M from shell
try first transfer file in binary mode.
you can try 'dos2ux
regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 03:16 AM
01-09-2008 03:16 AM
Re: Remove ^M from shell
tr -d "\015"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 07:38 AM
01-09-2008 07:38 AM
Re: Remove ^M from shell
# To take off the control chars from a file
# vi fn
Then Esc column and do the foloowing >
:%s/^M/ ( ie, control v control m) and enter .
This will take away the control Chracters.
If its a small file, you can even do # cat filename > newname
Rgds/ Kggj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 08:02 AM
01-09-2008 08:02 AM
Re: Remove ^M from shell
To remove the characters use the command sequence
:1,$s/^V^M//
followed by a return.
Note: Please be aware that the ^V will not echo on your screen,
but ^M will.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 09:58 AM
01-09-2008 09:58 AM
Re: Remove ^M from shell
http://www-h.eng.cam.ac.uk/help/tpl/unix/sed.html
# IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format
sed 's/.$//' # assumes that all lines end with CR/LF
sed 's/^M$//' # in bash/tcsh, press Ctrl-V then Ctrl-M
sed 's/\x0D$//' # gsed 3.02.80, but top script is easier
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 10:04 AM
01-09-2008 10:04 AM
Re: Remove ^M from shell
# perl -pe 's%\r\n%\n%; s%\032%% if eof' file
...mimics the HP-UX 'dos2ux' command including handling the 'sub' character (^Z) that marks the end of a DOS file.
To update your file(s) inplace and keep a backup copy as '.old', do:
# perl -pi.old -e 's%\r\n%\n%; s%\032%% if eof' file
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2008 11:42 PM
01-09-2008 11:42 PM
Re: Remove ^M from shell
I have uploaded in binary mode, it'll be in ascii mode.
Thanks everyone for your great support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2008 05:10 AM
01-10-2008 05:10 AM