Differences
This shows you the differences between two versions of the page.
|
wiki:software:unix_systems:edit [2008/12/02 10:11] Tomas Ratkus codebashed |
wiki:software:unix_systems:edit [2008/12/02 10:40] (current) Tomas Ratkus h1ed and codebashed |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== ^M Appearing after importing files from Windows ====== | ||
| + | |||
| + | The ^M is due to Windows and Unix using a different characters for newlines. | ||
| + | Windows' newline character shows up as ^M in UNIX text editors. | ||
| + | |||
| + | You can use the dos2unix command to remove the ^M characters. Simply run | ||
| + | |||
| + | **dos2unix filename > newfilename** | ||
| + | |||
| + | and what you specified as "newfilename" will contain your file, without the ^M characters. | ||
| + | |||
| + | You can then safely delete the old copy of the file with the ^M's in it. | ||
| + | |||
| + | Or, you can fix it with 'vi'. | ||
| + | (This is useful in cases where you are logged onto a system without dos2unix installed.) | ||
| + | |||
| + | * Open the file(s) in vi | ||
| + | * Type the following: | ||
| + | |||
| + | <codebash>ESC :%s/CTRL-VCTRL-M//g | ||
| + | CTRL-V, CTRL-M are CONTROL+V and CONTROL+M</code> | ||
| + | * This will look like: | ||
| + | |||
| + | :%s/^M//g, | ||
| + | |||
| + | * Then just save the file and exit vi. | ||
