AWK 学习笔记(一) 环境搭建

本篇为我学习AWK的笔记


1.  AWK 有3种类型

  • AWK − Original AWK from AT & T Laboratory.

  • NAWK − Newer and improved version of AWK from AT & T Laboratory.

  • GAWK − It is GNU AWK. All GNU/Linux distributions ship GAWK. It is fully compatible with AWK and NAWK.

2. AWK的环境设置

Step 1 − Download the source code from an authentic place. The command-line utility wget serves this purpose.

[jerry]$ wget http://ftp.gnu.org/gnu/gawk/gawk-4.1.1.tar.xz

Step 2 − Decompress and extract the downloaded source code.

[jerry]$ tar xvf gawk-4.1.1.tar.xz

Step 3 − Change into the directory and run configure.

[jerry]$ ./configure

Step 4 − Upon successful completion, the configure generates Makefile. To compile the source code, issue a make command.

[jerry]$ make

Step 5 − You can run the test suite to ensure the build is clean. This is an optional step.

[jerry]$ make check

Step 6 − Finally, install AWK. Make sure you have super-user privileges.

[jerry]$ sudo make install

That is it! You have successfully compiled and installed AWK. Verify it by executing the awk command as follows −

[jerry]$ which awk

On executing this code, you get the following result −

/usr/bin/awk



猜你喜欢

转载自blog.csdn.net/gaozhiqiang111/article/details/52709979