我想编写脚本,将没有DOS换行符的文件更改为具有DOS换行符的文件,但我无法确定如何找到不包含DOS换行符的文件。
我在Linux上有以下命令可用:
$ find -type f -exec file {} \; | grep -v CRLF
它能够正常运行并返回结果
./test/test.bat: ASCII text
然而,在OSX上我得到了:
$ find -type f -exec file {} \; | grep -v CRLF
find: illegal option -- t
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
我也尝试过
$ find . -type f -exec file {} \; | grep -v CRLF
cannot open `' (No such file or directory)
cannot open `' (No such file or directory)
cannot open `' (No such file or directory)
cannot open `' (No such file or directory)
... etc
有没有使用在OSX上使用不同的语法来完成这个任务的方法?
find
如何处理这种情况。 - Charles Duffy