shell - 如何检查 OS X 中 sed 的版本?

标签 shell command-line sed

我知道sed是否是GNU版本,可以像这样进行版本检查

$ sed --version

但这在 OS X 中不起作用。我该怎么做?

最佳答案

这可能不是您正在寻找的答案,但您却找不到。 Mac OS X sed 没有显示版本号的选项。

二进制文件中甚至没有版本号:

$ strings $(which sed)
$FreeBSD: src/usr.bin/sed/compile.c,v 1.28 2005/08/04 10:05:11 dds Exp $
$FreeBSD: src/usr.bin/sed/main.c,v 1.36 2005/05/10 13:40:50 glebius Exp $
$FreeBSD: src/usr.bin/sed/misc.c,v 1.10 2004/08/09 15:29:41 dds Exp $
$FreeBSD: src/usr.bin/sed/process.c,v 1.39 2005/04/09 14:31:41 stefanf Exp $
@(#)PROGRAM:sed  PROJECT:text_cmds-88
malloc
%lu: %s: unexpected EOF (pending }'s)
0123456789/\$
%lu: %s: command expected
%lu: %s: invalid command code %c
%lu: %s: command %c expects up to %d address(es), found %d
%lu: %s: unexpected }
%lu: %s: extra characters at the end of %c command
%lu: %s: command %c expects \ followed by text
%lu: %s: extra characters after \ at the end of %c command
%lu: %s: filename expected
w command
read command
branch
label
%lu: %s: empty label
%lu: %s: substitute pattern can not be delimited by newline or backslash
%lu: %s: unterminated substitute pattern
%lu: %s: extra text at the end of a transform command
%lu: %s: unterminated regular expression
%lu: %s: expected context address
realloc
%lu: %s: whitespace after %s
%lu: %s: duplicate label '%s'
%lu: %s: RE error: %s
%lu: %s: \ can not be used as a string delimiter
%lu: %s: newline can not be used as a string delimiter
%lu: %s: unbalanced brackets ([])
bin/sed
Unix2003
123456789
%lu: %s: \%c not defined in the RE
%lu: %s: unescaped newline inside substitute pattern
%lu: %s: unterminated substitute in regular expression
%lu: %s: more than one number or 'g' in substitute flags
%lu: %s: overflow in the 'N' substitute flag
%lu: %s: no wfile specified
%lu: %s: bad flag in substitute command: '%c'
%lu: %s: transform pattern can not be delimited by newline or backslash
%lu: %s: unterminated transform source string
%lu: %s: unterminated transform target string
%lu: %s: transform strings are not the same length
%lu: %s: undefined label '%s'
%lu: %s: unused label '%s'
Eae:f:i:ln
setlinebuf() failed
stdout
"%s"
 ..."
-i may not be used with stdin
stdin
rename()
%s: %s %s
in-place editing only
works for regular files
%s: name too long
%s/.!%ld!%s
%s: %s
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
first RE may not be empty
RE error: %s
%lu: %s: \%d not defined in the RE
COLUMNS
\abfrtv
\%03o

关于shell - 如何检查 OS X 中 sed 的版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37639496/

相关文章:

python - 一个 shell 脚本如何从自身内部执行另一个 shell 脚本

linux - 为 bash 设置默认命令

perl - 删除文件中包含特定字符的所有行

bash - sed:在文件最后一行的位置搜索和替换值

shell - 使用Power Shell获取具有页面布局的SharePoint页面列表

java - 如何以编程方式检查 AppEngine 应用程序版本是否已存在

windows - TShark 输出重定向

bash - 从大型文本文件中提取大型行列表

bash - 使用 vanilla Ubuntu,一个用于搜索和替换/取消注释代码块的脚本?

regex - grep 排除带有正则表达式字符串的字符串