Answers:
您需要安装gnu-sed
,而不仅仅是coreutils:
brew install gnu-sed
然后,您必须在上添加以下行.bash_profile
:
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
export MANPATH="/usr/local/opt/gnu-sed/libexec/gnuman:$MANPATH"
然后您的sed
版本应该是最新的:
$ sed --version
sed (GNU sed) 4.2.2
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <bug-sed@gnu.org>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
PATH
陈述。Just brew install gnu-sed
,它将以gsed
PATH
语句使您可以使用命令sed
而不是gsed
。没必要,但是您无需记住将字母附加g
到sed
命令中。
sed
BSD sed的程序。我不知道这是否有问题,但我希望它会成为问题。(如果是osx,然后是bsdisms)
alias sed=gsed
在个人资料中,也许吗?
-E
选件的普通OS X sed ,则应接受\t
。有关re_format
详细信息,请参见手册页。