Berkeley CSUA MOTD:Entry 21003
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/07/09 [General] UID:1000 Activity:popular
7/9     

2001/4/16-17 [Computer/SW/Languages/Perl, Computer/SW/OS/OsX] UID:21003 Activity:high
4/16    I have a bunch of ^M s from mac files i transfered over. I'm
        sure there is a quick and easy way to remove them all, but i
        don't know how to specify cntrl characters in my script.
        Someone please point the way.
        \_ Does vi's :1,$s/<ctr-v><ctr-m>// work?  I think emacs also
           has a remove trailing  function.
                \_ Are you really helping by giving it away?  He was 99% of
                   the way there.
        \_ man tr.  Or do a search/replace in your favorite editor.
               \_ For the hopelessly lazy: tr -d '\015' < file > newfile
           \_ yes fine, i could come up with "do a search/replace" myself
                the problem is that i don't know how to write ^M so that
                my editor can read and match. it.  How about i make this
                specific:  perl -pi -e 's/^M/ /g' FILES doesn't work. What
                do i need to type instead of "^M" or actually pressing the
                CNTRL and the M key together, so that i can match this char.
                Does anyone know what the ascii (alt+3) number is for this
                character or where i can find that?
                \_ Heh... guess what?  "man ascii".  "But if you teach a man
                   to fish...."
              \_ perl -pi -e 's/\r\n?/\n/' FILES
                 this will work for both Mac & DOS formatted files --dbushong
                 \_ Didn't you answer this question like 47 times before?
        \_ How many times has this been asked on the motd before?
        \_ just ftp your files over in ASCII mode