Unix Tech Tips

2. Removing ^M from UNIX text files

Using Perl :
Following command will change the orginal file itself so keep a backup copy .

perl -pi -e “s:^V^M::g” existing_file_name

You won’t see the Control V on typing but it is needed to generate control

character ^M.

Using sed :
sed -e `s/^V^M//g` existing_file_name > new_file_name

Using vi :
Open file in vi and enter the following at : prompt in command mode .


Pages: 1 2 3 4 5 6

Getting Started Guide:

Getting Started with Python Kiindle Book


This site uses Akismet to reduce spam. Learn how your comment data is processed.