安装新版gawk

下载

[root@docker-01 ~]# wget --no-check -certificate https://mirrors.tuna.tsinghua.edu.cn/gnu/gawk/gawk-4.2.0.tar.gz

解压进入解压目录

[root@docker-01 ~]# tar xf gawk-4.2.0.tar.gz 
[root@docker-01 ~]# cd gawk-4.2.0

编译

[root@docker-01 gawk-4.2.0]# ./configure --prefix=/usr/local/gawk4.2 && make && make install

创建软件连接,让awk指向刚新装的gawk版本

[root@docker-01 gawk-4.2.0]# ln -fs /usr/local/gawk4.2/bin/awk /usr/bin/awk 

此时调用awk将调用新的gawk,调用gawk将调用旧的awk

[root@docker-01 gawk-4.2.0]# awk --version
GNU Awk 4.2.0, API: 2.0
版权所有 © 1989, 1991-2017 自由软件基金会(FSF)。

该程序为自由软件,你可以在自由软件基金会发布的 GNU 通用公共许可证(GPL)第
3版或以后版本下修改或重新发布。

该程序之所以被发布是因为希望他能对你有所用处,但我们不作任何担保。这包含
但不限于任何商业适售性以及针对特定目的的适用性的担保。详情参见 GNU 通用公
共许可证(GPL)。

你应该收到程序附带的一份 GNU 通用公共许可证(GPL)。如果没有收到,请参看 http://www.gnu.org/licenses/ 。
[root@docker-01 gawk-4.2.0]# gawk --version
GNU Awk 4.0.2
Copyright (C) 1989, 1991-2012 Free Software Foundation.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
原文地址:https://www.cnblogs.com/liujunjun/p/12389053.html