#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    Northern Ohio
    Posts
    74
    Rep Power
    14

    removing EOL characters (^M) from DOS edited files


    I am trying to figure out how to remove the end of line characters that get put into files edited by windows apps so that I can use them in Linux.

    I am able to remove them manually by using 'vim -b', but am thinking that there must be an easier way.

    I appreciate any help offered.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Posts
    4
    Rep Power
    0
    It's a matter of converting \r\n to \n:

    perl -i.orig -npe 's/\r\n/\n/g' file_name_here_or_use_wildcard_character

    Original file becomes same_file_name.orig
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    Northern Ohio
    Posts
    74
    Rep Power
    14

    Thanks...


    Thanks, that was exactly what I was looking for.

IMN logo majestic logo threadwatch logo seochat tools logo