- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- replacing special characters with sed
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
08-02-2007 03:31 AM
08-02-2007 03:31 AM
I have a file that I'm having issues with special characters. Each new "entry" in the file begins with a ^M^L (when viewed in vi). For some reason, every now and then, there is an extra ^M^L, so the line starts with ^M^L^M^L I don't need the second sequence.
I tried using sed as follows:
sed s/^M^L^M^L/^M^L/g file1 > file2
That isn't working. Any pointers??
Scott
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2007 03:43 AM
08-02-2007 03:43 AM
Re: replacing special characters with sed
Check dos2ux:
#dos2ux file > file2
hope this works
Regards
- Tags:
- dos2ux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2007 03:50 AM
08-02-2007 03:50 AM
Re: replacing special characters with sed
# perl -pe 's/^\015\014\015\014/\015\014/' file
...or to update in-place:
# perl -pi.old -e 's/^\015\014\015\014/\015\014/' file
...which will preserve a copy of "file" as "file.old".
Regards!
...JRF...
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2007 04:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2007 04:06 AM
08-02-2007 04:06 AM
Re: replacing special characters with sed
Thanks to everyone for their assistance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2007 04:07 AM
08-02-2007 04:07 AM
Re: replacing special characters with sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2007 09:14 PM
08-02-2007 09:14 PM
Re: replacing special characters with sed
The last time there was a thread about ^M, there was no way to enter it in a real shell but you could enter it in vi.
Did you have any problems in a shell?