Sed - 环境设置

Sed - 环境设置 首页 / Sed入门教程 / Sed - 环境设置

本章介绍如何在GNU/Linux系统上设置SED环境。

从软件包安装

通常,大多数GNU/Linux发行版默认都提供SED。使用哪个命令来确定系统中是否存在该命令。如果没有,请使用 apt 软件包管理器在基于Debian的GNU/Linux上安装SED,如下所示:

[jerry]$sudo apt-get install sed 

安装后,请确保可通过命令行访问SED。

[jerry]$sed --version

执行上述代码后,您将得到以下输出:

sed (GNU sed) 4.2.2 
Copyright (C) 2012 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later . 
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: . 
General help using GNU software: . 
E-mail bug reports to: . 
Be sure to include the word "sed" somewhere in the "Subject:" field.

同样,要在基于RPM的GNU/Linux上安装SED,请使用yum软件包管理器,如下所示:

[root]# yum -y install sed

安装后,请确保可通过命令行访问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: . 
General help using GNU software: . 
E-mail bug reports to: . 
Be sure to include the word "sed" somewhere in the "Subject:" field.

从源代码安装

由于GNU SED是GNU项目的一部分,因此可以免费下载其源代码。无涯教程已经了解了如何使用程序包管理器安装SED。现在了解如何从源代码安装SED。

以下安装适用于任何GNU/Linux软件,以及大多数其他免费可用的程序。以下是安装步骤:

  • 从真实位置下载源代码。命令行实用程序 wget 用于此目的。

[jerry]$wget ftp://ftp.gnu.org/gnu/sed/sed-4.2.2.tar.bz2
  • 解压缩并提取下载的源代码。

    链接:https://www.learnfk.comhttps://www.learnfk.com/sed/sed-environment.html

    来源:LearnFk无涯教程网

  • [jerry]$tar xvf sed-4.2.2.tar.bz2 

    切换到目录并运行configure

    [jerry]$./configure 

    成功完成后, configure 会生成Makefile。要编译源代码,请发出 make 命令。

    [jerry]$make
  • 这是一个可选步骤。

    无涯教程网

  • [jerry]$make check 
  • 最后,安装SED实用程序。确保您具有超级用户特权。

  • [jerry]$sudo make install 

    通过执行 sed 命令验证它,如下所示:

    [jerry]$sed --version

    执行上述代码后,您将得到以下输出:

    sed (GNU sed) 4.2.2 
    Copyright (C) 2012 Free Software Foundation, Inc. 
    License GPLv3+: GNU GPL version 3 or later . 
    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: . 
    General help using GNU software: . 
    E-mail bug reports to: . 
    Be sure to include the word "sed" somewhere in the "Subject:" field.

    祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

    技术教程推荐

    微服务架构核心20讲 -〔杨波〕

    零基础学Python -〔尹会生〕

    Java性能调优实战 -〔刘超〕

    软件设计之美 -〔郑晔〕

    正则表达式入门课 -〔涂伟忠〕

    跟月影学可视化 -〔月影〕

    用户体验设计实战课 -〔相辉〕

    技术面试官识人手册 -〔熊燚(四火)〕

    AI大模型企业应用实战 -〔蔡超〕

    好记忆不如烂笔头。留下您的足迹吧 :)