像 Windows 的 dos2unix 之类的东西吗? [英] Anything like dos2unix for Windows?
本文介绍了像 Windows 的 dos2unix 之类的东西吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Windows 上创建了一些 shell 脚本,我想在它们上运行 dos2unix
.
但正如我所读到的 dos2unix
在 Linux 环境中工作,那么有没有办法在 Windows 中工作时将我的文件转换为 UNIX 格式?>
我已经安装了 CYGWIN,但我面临一些问题
Administrator@SGH735082N ~$密码/home/管理员管理员@SGH735082N ~$ cd C:CVS 代码管理员@SGH735082N/cygdrive/c/CVS$ dos2Unix BLPDB000BLPDB000:dos2Unix 处理 BLPDB000:没有那个文件或目录管理员@SGH735082N/cygdrive/c/CVS$ dos2Unix -hdos2Unix:参数错误 -h:未知选项管理员@SGH735082N/cygdrive/c/CVS$ dos2Unix --helpdos2Unix 版本 0.1.3将文本文件的行尾从DOS 风格 (0x0d 0x0a) 到 UNIX 风格 (0x0a)用法:dos2Unix [OPTION...] [输入文件列表...]主要选项(并非所有选项都适用)-A, --auto 输出格式将与自动检测的源相反格式-D, --u2d 输出为 DOS 格式--unix2dos 输出为 DOS 格式-U, --d2u 输出为 UNIX 格式--dos2unix 输出将采用 UNIX 格式--force 忽略二进制文件检测--safe 不修改二进制文件帮助选项-?, --help 显示此帮助信息--usage 显示简短的使用信息--version 显示版本信息--license 显示许可信息其他论点[输入文件列表...] 对于列出的每个文件,就地转换.如果未指定,则使用 stdin/stdout管理员@SGH735082N/cygdrive/c/CVS$管理员@SGH735082N/cygdrive/c/CVS$ dos2Unix -oBLPDB000dos2Unix:参数错误 -oBLPDB000:未知选项管理员@SGH735082N/cygdrive/c/CVS$ dos2Unix -k BLPDB000dos2Unix:参数错误 -k:未知选项管理员@SGH735082N/cygdrive/c/CVS$ dos2Unix BLPDB000.txtBLPDB000.txt:dos2Unix 处理 BLPDB000.txt:没有那个文件或目录管理员@SGH735082N/cygdrive/c/CVS$密码/cygdrive/c/CVS
解决方案
您可以使用 Notepad++.
递归转换目录的说明如下:
- 菜单:搜索 ->在文件中查找...
- Directory = 要递归转换为 Unix 格式的目录.例如,C:MyDir
- 找到什么 =
- 替换为 =
- 搜索模式 = 扩展
- 按在文件中替换"
I have some shell scripts created on windows I want to run dos2unix
on them.
But as I have read that dos2unix
works in Linux environment so, is there a way that I can convert my files to UNIX format while working in Windows?
I have already installed CYGWIN but I am facing some issues as
Administrator@SGH735082N ~
$ pwd
/home/Administrator
Administrator@SGH735082N ~
$ cd C:CVS Code
Administrator@SGH735082N /cygdrive/c/CVS
$ dos2Unix BLPDB000
BLPDB000:
dos2Unix processing BLPDB000: No such file or directory
Administrator@SGH735082N /cygdrive/c/CVS
$ dos2Unix -h
dos2Unix: bad argument -h: unknown option
Administrator@SGH735082N /cygdrive/c/CVS
$ dos2Unix --help
dos2Unix version 0.1.3
converts the line endings of text files from
DOS style (0x0d 0x0a) to UNIX style (0x0a)
Usage: dos2Unix [OPTION...] [input file list...]
Main options (not all may apply)
-A, --auto Output format will be the opposite of the autodetected source
format
-D, --u2d Output will be in DOS format
--unix2dos Output will be in DOS format
-U, --d2u Output will be in UNIX format
--dos2unix Output will be in UNIX format
--force Ignore binary file detection
--safe Do not modify binary files
Help options
-?, --help Show this help message
--usage Display brief usage message
--version Display version information
--license Display licensing information
Other arguments
[input file list...] for each file listed, convert in place.
If none specified, then use stdin/stdout
Administrator@SGH735082N /cygdrive/c/CVS
$
Administrator@SGH735082N /cygdrive/c/CVS
$ dos2Unix -oBLPDB000
dos2Unix: bad argument -oBLPDB000: unknown option
Administrator@SGH735082N /cygdrive/c/CVS
$ dos2Unix -k BLPDB000
dos2Unix: bad argument -k: unknown option
Administrator@SGH735082N /cygdrive/c/CVS
$ dos2Unix BLPDB000.txt
BLPDB000.txt:
dos2Unix processing BLPDB000.txt: No such file or directory
Administrator@SGH735082N /cygdrive/c/CVS
$ pwd
/cygdrive/c/CVS
解决方案
You can use Notepad++.
The instructions to convert a directory recursively are as follows:
- Menu: Search -> Find in Files...
- Directory = the directory you want to be converted to Unix format, recursively. E.g., C:MyDir
- Find what =
- Replace with =
- Search Mode = Extended
- Press "Replace in Files"
这篇关于像 Windows 的 dos2unix 之类的东西吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文