资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

Linux常用命令--dos2unix

1.功能:DOS/MAC文件转化成UNIX文件格式,功能跟notepad编辑器下的编辑-文档格式转换-转换为UNIX格式一样

创新互联专注于企业成都全网营销、网站重做改版、茄子河网站定制设计、自适应品牌网站建设、H5建站商城网站开发、集团公司官网建设、外贸网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为茄子河等各大城市提供网站开发制作服务。

2.安装方式:yum install -y dos2unix

3.语法:

dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]

4.参数:

-h --help 帮助

-k --keepdate 时间戳保持不变

-q --quiet 静默模式,不输出告警和信息

              Quiet mode. Suppress all warning and messages.

-c --convmode 设定转化模式,模式有:ASCII, 7bit, ISO

-o --oldfile file 默认模式,将转换后的文件直接写到原文件中

-n --newfile infile outfile  将infile中的内容写入到outfile中

5.例子

[MySQL@mysql ~]$ ls -lh

total 12K

-rw-r--r--. 1 root  root 31 Jun 29 15:43 echo_test.sh

-rw-r--r--. 1 root  root 18 Jun 29 15:41 test.txt

-rw-r--r--. 1 mysql dba  68 Jun 23 22:47 week.txt

#中间把test.txt、week.txt删除#

[mysql@mysql ~]$ dos2unix -k echo_test.sh 

dos2unix: converting file echo_test.sh to UNIX format ...

[mysql@mysql ~]$ ls -lh

total 4.0K

-rw-r--r--. 1 mysql dba 30 Jun 29 15:43 echo_test.sh#时间戳未变

[mysql@mysql ~]$ dos2unix  echo_test.sh 

dos2unix: converting file echo_test.sh to UNIX format ...

[mysql@mysql ~]$ ls -lh

total 4.0K

-rw-r--r--. 1 mysql dba 30 Jun 29 16:03 echo_test.sh#时间戳变化

[mysql@mysql ~]$ dos2unix  -n echo_test.sh  test.sh 

dos2unix: converting file echo_test.sh to file test.sh in UNIX format ...

[mysql@mysql ~]$ ls -lh

total 8.0K

-rw-r--r--. 1 mysql dba 30 Jun 29 16:03 echo_test.sh

-rw-r--r--. 1 mysql dba 30 Jun 29 16:03 test.sh


网页名称:Linux常用命令--dos2unix
网页地址:http://cdkjz.cn/article/jphhge.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220