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

2023-12-14

我知道如果sed是GNU版本,版本检查可以这样完成

$ sed --version

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


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

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

$ 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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何检查 OS X 中 sed 的版本? 的相关文章

  • 使用 plistBuddy 获取值数组

    var keychain access groups declare a val usr libexec PlistBuddy c Print var sample plist echo val echo val 0 Ouput Array
  • 如何使用 sed 将空格替换为 \(space)?

    当我使用 sed 将所有空格替换为 X 时 该命令有效 命令为 sed s X g filelist tmp 但是 当我尝试用 space 替换所有出现的空格时 代码是 sed s g filelist tmp 这不起作用 我究竟做错了什么
  • 如何强制jar使用(或jar运行的jvm)utf-8而不是系统的默认编码

    我的Windows默认编码是GBK 而我的Eclipse完全是utf 8编码 因此 在我的 Eclipse 中运行良好的应用程序崩溃了 因为导出为 jar 文件时这些单词变得不可读 我必须在 bat 文件中写入以下行才能运行该应用程序 st
  • 使用 Windows 命令行将多行环境变量回显到文本文件

    我有一个环境变量 SSH PRIVATE KEY 并希望使用命令行将其打印到文件中 而不使用批处理文件 这是因为我需要在 Gitlab Ci yml 脚本中使用此文件 在 Linux 中 这很简单 echo SSH PRIVATE KEY
  • npm 运行如何工作?

    当我打字时会发生什么npm run
  • 在 UNIX 中删除相同的文件

    我正在处理大量 30 000 个 大小约为 10MB 的文件 其中一些 我估计 2 实际上是重复的 我只需要为每个重复的对 或三元组 保留一个副本 您能建议我一种有效的方法吗 我正在unix上工作 您可以尝试使用此代码片段在删除之前先获取所
  • shell中如何求数组的长度?

    shell中如何求数组的长度 例如 arr 1 2 3 4 5 我想得到它的长度 在本例中是 5 a 1 2 3 4 echo a 4
  • 如何使用 VB6 调用 Windows shell 命令?

    究竟如何使用 VB6 才能像从命令行一样调用任何 Windows shell 命令 例如 一些微不足道的事情 echo foo 操作方法如下 Shell cmd echo foo vbNormalFocus
  • 无需 root 访问权限即可安装 zsh? [关闭]

    Closed 这个问题是无关 help closed questions 目前不接受答案 有可能 以及如何 我确实需要在几台具有 ssh 访问权限 但没有 root 访问权限 的远程计算机上使用此功能 下载 zsh wget O zsh t
  • 如何在 Linux/OS X 上温和地终止 Firefox 进程

    我正在使用 Firefox 进行一些自动化操作 尽管我可以从 shell 打开 Firefox 窗口 但我无法正确终止它 如果我kill火狐进程与kill 3 or kill 2当我下次打开新的 Firefox 窗口时 命令会询问我是否要在
  • 如何列出 nginx 中的所有虚拟主机

    有没有一个命令可以列出 CentOS 上 nginx 下运行的所有虚拟主机或服务器 我想将结果通过管道传输到文本文件以用于报告目的 我正在寻找与我用于 Apache 的命令类似的命令 apachectl S 2 gt 1 grep 端口 8
  • 比较linux中的两个未排序列表,列出第二个文件中的唯一项

    我有 2 个包含号码列表 电话号码 的文件 我正在寻找一种列出第二个文件中第一个文件中不存在的数字的方法 我尝试过各种方法 comm getting some weird sorting errors fgrep v x f second
  • 不要将变量内容视为 sed 中的特殊字符

    我有以下内容sed命令 sed i 4i CHANGES CHANGELOG rst 然而 我的 CHANGES变量看起来像这样 title list elem elem 因此 上述命令失败并出现以下错误 sed e expression
  • 从命令行减少 PNG 文件的位深度

    我可以从 CLI 执行什么命令或一系列命令来递归遍历目录树并将该树中所有 PNG 文件的位深度从 24bpp 减少到 16bpp 命令应该保留 alpha 层并且不应该增加 PNG 文件的大小 事实上减少会更好 我有一个基于 OSX 的系统
  • 如何使用 Clojure 在命令行中更改目录?

    我正在寻找的是 Windows 命令行中的这种命令行交互 C temp1 gt clj some script clj C temp2 gt 其中 some script clj 包含类似以下内容 cd c temp2 那么问题来了 如何实
  • Windows 相当于 Unix find 命令,用于搜索多种文件类型

    虽然在 Windows 中安装了 cygwin 可以提供大部分 unix 命令 但我仍然想知道如何使用 Windows find 命令在一个命令中搜索多个文件类型 ie find name cpp o name h o name java
  • 在 Shell 中提取匹配模式后的字符串

    如何提取 Shell 脚本中匹配模式后面的任何字符串 我知道 Perl 脚本中的此功能 但不知道 Shell 脚本中的功能 以下是示例 subject 01 这是一个示例主题 可能会有所不同 我必须提取 Subject 01 后面的任何字符
  • 在 Django shell 会话期间获取 SQL 查询计数

    有没有办法打印 Django ORM 在 Django shell 会话期间执行的原始 SQL 查询的数量 Django 调试工具栏已经提供了此类信息 例如 5 QUERIES in 5 83MS但如何从 shell 中获取它并不明显 您可
  • 如何在 Bash 中删除字符串的第一部分?

    该代码将给出第一部分 但是如何删除它并获取没有第一部分的整个字符串 echo first second third etc cut d f1 你应该看看info cut 这将解释什么f1 means 实际上我们只需要第二个字段之后的字段 f
  • 如何将命令输出作为多个参数传递给另一个命令

    我想将命令的每个输出作为多个参数传递给第二个命令 例如 grep pattern input returns file1 file2 file3 我想复制这些输出 例如 cp file1 file1 bac cp file2 file2 b

随机推荐