Linux常用命令--dos2unix
2016-06-29 16:54
525 查看
1.功能:DOS/MAC文件转化成UNIX文件格式,功能跟notepad编辑器下的编辑-文档格式转换-转换为UNIX格式一样
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
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 socket 初步
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Unix 即将迎来 50 岁
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程