Removing ^M's

From JoatWiki
Jump to: navigation, search

(Using Vi) The only hard part about this is figuring out the proper key combination to generate the regular expression. To remove the ^M's, type:

1,$s/^M//g

or

%s/^M//g

where:

   * "1,$" or "%" designates "do the following to the whole file"
   * "^M" is generated by hitting "Control-V Control-M" (that's a capital V and M)
   * "g" signifies "perform the substitution with every matching instance in each line"

Source: alt.unix.wizards newsgroup

<comments>Removing_%5EM%27s</comments>

Personal tools