Select Page

Art of BI: Removing ^M From Linux Files

Christian Screen | | January 20, 2012

I was at a project recently where someone had updated several Linux config/text files using a Windows machine.
They FTP‘d the files to their desktop, used notepad or something similar to make the edits, and then FTP’d the file back to the Linux server thinking that all would work swimmingly. Unfortunately they overwrote the original files when they uploaded the files back to the Linux server.

Tux, the Linux penguin

Image via Wikipedia

As you know when this happens, Linux can recognize these foreign line breaks and places a nasty ^M at the end of each break as it interprets it as an actual character. This renders most config files, especially a XML based config file, useless for parsing by the program trying to read the file.

The solution is regular expression based and looks kinda funky but it works.

Basically open the file in question using the VI editor. Hit the colon command to start the menu input and enter the expression below against the file.

:%s/[ctrlkey+v and ctrl-key+M]//g

which will give you



Enhanced by Zemanta

Subscribe to Our Blog

Never miss a post! Stay up to date with the latest database, application and analytics tips and news. Delivered in a handy bi-weekly update straight to your inbox. You can unsubscribe at any time.

ORA-12154: TNS:could not resolve the connect identifier specified

Most people will encounter this error when their application tries to connect to an Oracle database service, but it can also be raised by one database instance trying to connect to another database service via a database link.

Jeremiah Wilton | March 4, 2009

12c Upgrade Bug with SQL Tuning Advisor

Learn the steps to take on your Oracle upgrade 11.2 to 12.1 if you’re having performance problems. Oracle offers a patch and work around to BUG 20540751.

Megan Elphingstone | March 22, 2017

Oracle EPM Cloud Vs. On-Premises: What’s the Difference?

EPM applications help measure the business performance. This post will help you choose the best EPM solutions for your organization’s needs and objectives.

Bobby Ellis | April 10, 2018

Work with Us

Let’s have a conversation about what you need to succeed and how we can help get you there.


Work for Us

Where do you want to take your career? Explore exciting opportunities to join our team.