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 ]
Scripts / handy tips
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 Removing ^M from files
Author: Lars Eighner 
Date:   05-01-03 08:30

The perl one-liner give in the article on this subject seems to me to be needlessly confusing.
I use: perl -pi -e 's/\r//g' <filespec>
It appears to me to work and there is no question of how to enter a ^M.

Reply To This Message
 
 Re: Removing ^M from files
Author: parv 
Date:   06-01-03 19:14

entering "^M" by any means is not difficult, just the understanding of how to do it.


anyway, another way to represent "^M" is via "\cM" (in perl). btw, on comp.unix.* newsgroups, topic of modifying "^M" comes often.

Reply To This Message
 
 Re: Removing ^M from files
Author: Erin 
Date:   13-01-03 00:11

I am a bit happier with;

tr -d '\015' < in-file > out-file

Erin

Reply To This Message
 
 See also
Author: Dan Langille 
Date:   14-01-03 22:35

See also http://www.freebsddiary.org/phorum/read.php?f=4&i=125&t=125

Reply To This Message
 
 Re: See also
Author: Erin 
Date:   14-01-03 23:21

I think you meant;

http://www.freebsddiary.org/phorum/read.php?f=1&i=2740&t=2740


-Erin

Reply To This Message
 
 Re: See also
Author: Dan Langille 
Date:   15-01-03 02:20

Yes, thanks.

Reply To This Message
 
 Re: See also
Author: Dan Langille 
Date:   15-01-03 02:23

Actually, I meant: See also http://www.freebsddiary.org/phorum/list.php?f=3&article_id=308

Reply To This Message
 
 Re: See also
Author: Isaac 
Date:   16-01-03 02:06

To enter "^M" you press ctrl+v+j.

Reply To This Message
 
 Re: Removing ^M from files
Author: Dr.Lektroluv 
Date:   03-02-03 16:41

I do it like this

find [PATH] -name '*.php' -exec sed -e 's/<CTRL-V><CTRL-M>//g' {} \;

Reply To This Message
 
 Re: Removing ^M from files
Author: Dr.Lektroluv 
Date:   03-02-03 16:43

should replace 's/*******//g' the *** with CTRL-V CTRL-M and both these CTRL between html tags

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