一般情况下,sed默认提供在大多数的GNU/ Linux发行版。使用该命令,以确定其是否存在于您的系统上。如果没有,那么在基于Debian GNU/ Linux可以使用apt包管理器,如下所示安装sed:
[root]# sudo apt-get install sed |
[root]# sed --versio |
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.htmll>. 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.
同样,基于GNU/Linux的RPM安装sed,用yum包管理器,如下所示:
[root]# yum -y install sed |
[root]# sed --version |
GNU sed version 4.2.1 Copyright (C) 2009 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, to the extent permitted by law. 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-gnu-utils@gnu.org>. Be sure to include the word "sed" somewhere in the "Subject:" field.
由于GNU sed是GNU计划的一部分,它的源代码都可以免费下载。我们已经看到了如何使用软件包管理器安装sed。现在,了解如何从源代码安装sed。
下面安装适用于任何的GNU/Linux软件,和大多数其他可自由使用的程序。下面是安装步骤:
第1步 - 从一个真实的地方下载的源代码。命令行实用程序wget服务于这个目的。
[root]# wget ftp://ftp.gnu.org/gnu/sed/sed-4.2.2.tar.bz2 |
[root]# tar xvf sed-4.2.2.tar.bz2 |
[root]# ./configure |
[root]# make |
[root]# make check |
[root]# sudo make install |
[root]# 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.htmll>. 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.