我正在尝试编写更改没有 DOS 行结尾的文件的脚本,以将它们更改为具有 DOS 行结尾,但是我对如何定位不包含 DOS 行结尾的文件感到困惑。
我有以下适用于 linux 的命令
$ find -type f -exec file {} \; | grep -v CRLF
Run Code Online (Sandbox Code Playgroud)
它工作并返回
./test/test.bat: ASCII text
Run Code Online (Sandbox Code Playgroud)
但是,在 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]
Run Code Online (Sandbox Code Playgroud)
我也试过
$ find . -type f -exec file {} …Run Code Online (Sandbox Code Playgroud)