# Convert DOS/MAC text files to UNIX text file format

**URL:** <https://linux-tips.com/t/convert-dos-mac-text-files-to-unix-text-file-format/159>\
**Category:** Shell\
**Created:** [April 18, 2008, 1:19pm UTC](https://linux-tips.com/t/convert-dos-mac-text-files-to-unix-text-file-format/159 "2008-04-18T13:19:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alperakcan](https://linux-tips.com/letter_avatar_proxy/v4/letter/a/c5a1d2/32.png) [@alperakcan](https://linux-tips.com/u/alperakcan)\
**Post date:** [April 18, 2008, 1:19pm UTC](https://linux-tips.com/t/convert-dos-mac-text-files-to-unix-text-file-format/159/1 "2008-04-18T13:19:36Z")

</div>

If you want to convert a dos text file with ugly ^M’s, you may use following commands;

```
dos2unix filefromdos < filein > fileout

sed 's/.$//' filein > fileout

sed 's/.$//' -i file

```

Some distributions do not include `dos2unix`, and fromdos/todos commands, but every single of them has `sed`. And to convert all files in directory ‘path’;

```
find path -type f -print -exec sed 's/.$//' -i {} \;

```

Cheers.
