---
title: "UNIX: DOS To UNIX"
author: "jacky"
date: "2009-08-26T11:58:16Z"
tags: []
slug: "unix-dos-to-unix"
draft: false
lastmod: "2009-08-26T11:58:16Z"
id: 457805
url: "https://jacky.iteye.com/blog/457805"
---

Features: 
1. Convert window format to UNIX format
2. Keep the last modify date of file unchanged


```shell

if [ $# -ne 1 ];then
   echo
   echo "USAGE: $0 fileName"
   echo
   exit -1
fi
file=$1
tr -d '\r' <$file >$file.tmp
touch -r $file $file.tmp
mv $file.tmp $file
chmod 777 $file

```