The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Article Feedback
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 Stripping ^M
Author: Taz 
Date:   21-09-11 15:37

After a long painful learning curve I came up with this solution to strip out the ^M characters Windows leaves.

sed 's/\^M$//' file > tfile
mv tfile file

the ^M (ascii 13) has to be entered as the actual ascii character. The $ is what sed uses to indicate the end of line. This works under sh.

This script only strips the ^M's off of the end of the lines.



Post Edited (21-09-11 15:39)

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org