dos2unix用法
windows下编写的脚本,上传到linux上执行,有时会出现莫名其妙的结果,也是折腾了半天才找出原因,windows和linux有些编码不同,经dos2unix处理后,结果一切正常
man dos2unix结果如下,英文不难理解,一看就基本懂,所以也懒得翻译了
NAME
dos2unix - DOS/MAC to UNIX text file format converter
SYNOPSYS
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...]
Options:
[-hkqV] [--help] [--keepdate] [--quiet] [--version]
DESCRIPTION
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC
format to UNIX format.
OPTIONS
The following options are available:
-h --help
Print online help.
-k --keepdate
Keep the date stamp of output file same as input file.
-q --quiet
Quiet mode. Suppress all warning and messages.
-V --version
Prints version information.
-c --convmode convmode
Sets conversion mode. Where convmode is one of: ASCII, 7bit, ISO, Mac with ASCII
being the default. Simulates dos2unix under SunOS.
-o --oldfile file ...
Old file mode. Convert the file and write output to it. The program default to run
in this mode. Wildcard names may be used.
-n --newfile infile outfile ...
New file mode. Convert the infile and write output to outfile. File names must be
given in pairs and wildcard names should NOT be used or you WILL lose your files.
EXAMPLES
Get input from stdin and write output to stdout.
dos2unix
Convert and replace a.txt. Convert and replace b.txt.
dos2unix a.txt b.txt
dos2unix -o a.txt b.txt
Convert and replace a.txt in ASCII conversion mode.
dos2unix a.txt -c iso b.txt
Convert and replace b.txt in ISO conversion mode.
dos2unix -c ascii a.txt -c iso b.txt
Convert c.txt from Mac to Unix ascii format.
dos2unix -c mac c.txt b.txt
Convert and replace a.txt while keeping original date stamp.
dos2unix -k a.txt
dos2unix -k -o a.txt
Convert a.txt and write to e.txt.
dos2unix -n a.txt e.txt
Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt.
dos2unix -k -n a.txt e.txt
Convert and replace a.txt. Convert b.txt and write to e.txt.
dos2unix a.txt -n b.txt e.txt
dos2unix -o a.txt -n b.txt e.txt
Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt.
Convert d.txt and write to f.txt.
dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt
dos2unix用法的更多相关文章
- Linux命令dos2unix 从windows转换到linux --- nuix2dos从linux转换到windows
dos2unix命令用来将DOS格式的文本文件转换成UNIX格式的(DOS/MAC to UNIX text file format converter).DOS下的文本文件是以\r\n作为断行标志的 ...
- dos2unix 命令
最近在学习shell编程,可是在<Linux程序设计>指定的网站上下载了源码,使用的时候却一直出问题.提示:"bash: ./here1:/bin/sh^M:损坏的解释器: 没有 ...
- dos2unix
dos2unix 实际上就是把文本文件里面的^M删除,我一般懒得用这个命令,vi里面用一个命令(:%s/^m//g)删除即可. 用法举例: dos2unix a.txt b.txt 要把一批文件都do ...
- Linux命令之dos2unix
Linux命令之dos2unix (2011-09-22 11:24:06) 转载▼ 标签: 杂谈 Linux命令之dos2unix - 将DOS格式文本文件转换成UNIX格式 用途说明 dos2 ...
- Shell之sed用法 转滴
通过例子学习sed的用法 1,sed介绍 sed可删除(delete).改变(change).添加(append).插入(insert).合.交换文件中的资料行,或读入其它档的资料到 文> ...
- iconv内容,convmv文件名,unix2dos,dos2unix文件格式转换,od/cut/wc/dd/diff/uniq/nice/du等命令,linux文件名乱码,文件名,文件内容,vim编码设置
1.enconv文件名编码转换,比如要将一个GBK编码的文件转换成UTF-8编码,操作如下 enconv -L zh_CN -x UTF-8 filename enconv -L GB2312 -x ...
- dos2unix与unix2dos之学习记录
1. unix2dos与dos2unix这两个tool是用来干什么的? 这首先应该要说明一下背景知识: unix类操作系统下,换行字符是\n: 而早期的dos操作系统,其换行字符是由\r\n组成. 所 ...
- Shell命令-文件及内容处理之iconv、dos2unix
文件及内容处理 - iconv.dos2unix 1. iconv:转换文件的编码格式 iconv命令的功能说明 iconv 命令是 linux 下用于文件转编码的常用命令,对于同时使用 window ...
- dos2unix详解
Linux命令之dos2unix - 将DOS格式文本文件转换成UNIX格式 dos2unix安装 首先说明dos2unix是将dos文本转换为unix文本,不是将gbk转换为utf8,跟文本的编码格 ...
随机推荐
- 【Effective Java】7、优先考虑泛型方法
package cn.xf.cp.ch02.item27; import java.util.HashSet; import java.util.Set; public class Union { / ...
- HTML5+Activex+Singr+ABP+MongoDB
最近在.net DDD开发领域有个炒的很火的框架叫ASP.NET Boilerplate看上去很牛逼的样子,为什么我会觉得很牛逼呢? 第一:我看不懂. 第二:关注的人多,我选框架就像进饭馆,哪家人 ...
- 设置MySQL允许外网访问
1:设置mysql的配置文件 /etc/mysql/my.cnf 找到 bind-address =127.0.0.1 将其注释掉://作用是使得不再只允许本地访问: 重启 ...
- VS Code前端开发利器-常用快捷键
1.Ctrl+N ,新建文件,新建文件后需要先进行保存(Ctrl+S)并设置文件扩展名: 2.! +Tab,快速创建H5框架,文件扩展名必须为html: 3.Ctrl+Shift+P ,调出命令列表, ...
- 高性能javascript学习笔记系列(4) -算法和流程控制
参考高性能javascript for in 循环 使用它可以遍历对象的属性名,但是每次的操作都会搜索实例或者原型的属性 导致使用for in 进行遍历会产生更多的开销 书中提到不要使用for in ...
- Eclipse 寻找迷失的ID
这一篇会介绍用一种蠢的办法找拓展点常量ID. 1.打开IDE,之后什么都不干,直接关闭IDE,将当前工作区间(workspace)上的文件.metadata\.plugins\org.eclipse. ...
- ABAP中RETURN与EXIT语句的区别
EXIT:1) EXIT如果出现在循环中,退出的是整个循环操作,.程序会从循环结束处开始继续执行,其作用相当于Java与C++中的break.2)EXIT如果出现在循环之外,退出的是当前执行的程序块( ...
- Android 短信的还原
上篇文章讲到<Android 短信的备份>,本文主要实现Android 短信的还原,即是将一条 布局文件: <RelativeLayout xmlns:android="h ...
- NSCache详解
NSCache---详解 NSCache: NSCache是苹果官方提供的缓存类,在AFNetworking中,使用它来进行图片缓存. NSCache是线程安全的,在多线程操作中,不需要对Cache进 ...
- iOS--XML三种解析方法( XMLDictionary)、(GDataXMLNode)、(NSXMLParser)
iOS9之后,默认网络请求是https,所有我们要设置一下网络安全,具体设置如下 1.第三方类库 XMLDictionary 下载地址: https://github.com/nicklockwood ...