tôi biết nếu sed
là phiên bản GNU, phiên bản kiểm tra có thể được thực hiện nhưTôi làm cách nào để kiểm tra phiên bản sed trong OS X?
$ sed --version
Nhưng điều này không làm việc trong OS X. Làm thế nào tôi có thể làm điều đó?
tôi biết nếu sed
là phiên bản GNU, phiên bản kiểm tra có thể được thực hiện nhưTôi làm cách nào để kiểm tra phiên bản sed trong OS X?
$ sed --version
Nhưng điều này không làm việc trong OS X. Làm thế nào tôi có thể làm điều đó?
Đây có thể không phải là câu trả lời bạn đang tìm kiếm, nhưng bạn không thể. Mac OS X sed
không có tùy chọn để hiển thị số phiên bản.
Thậm chí không có một số phiên bản trong hệ nhị phân:
$ 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)
/\$
%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
Nhìn xuyên qua phiên bản khác nhau của sed
trong text_cmds
không có nhiều thay đổi.
10.0.0
Dùng NetBSD sed
từ mùa thu 199810.3.0
sử dụng FreeBSD sed
từ mùa thu năm 2002 nhưng rời khỏi người đàn ông trang không thay đổi, thêm -E
biểu thức thông thường kéo dài và -i
chỉnh sửa tại chỗ.10.4.0
Đã có một số sửa để chỉnh sửa tại chỗ, và thay đổi người đàn ông trang để FreeBSD người đàn ông trang từ mùa thu năm 2004.10.5.0
cập nhật để FreeBSD sed từ mùa thu năm 2005, thêm -l
đầu ra dòng đệm và nhiều tinh chỉnh/sửa lỗi để chỉnh sửa tại chỗ.10.6.0
Đã thêm một tham chiếu đến compat(5)
trong trang-man.Các phiên bản của hệ điều hành có thể được kiểm tra, thay vì tiện ích sed
, bởi một trong hai sử dụng uname -r
hoặc sw_vers -productversion
:
case $(sw_vers -productversion) in
10.[012].*) echo no in-place editig, EREs, or line-buffered output;;
10.[45].*) echo no line-buffered output;;
10.[6789].*) echo newest version as of writing;;
10.1[01].*) echo newest version as of writing;;
esac
(tiện ích BSD không versioned bởi vì chúng được coi là một phần của họ hệ điều hành)
đáng ngạc nhiên là không có số phiên bản nào ngay cả trong nhị phân. cảm ơn bạn. rất hữu ích! – tsrrhhh
Không sao, vui lòng trợ giúp! :) – Will
Mặc dù không có số phiên bản chính thức, nhưng chuỗi 'strings' đang hiển thị các phiên bản và ngày RCS cho 4 trong số các tệp mã nguồn. Đó là đủ, tùy thuộc vào lý do tại sao chuỗi phiên bản là muốn. –