AWK – Environment

  • Post author:
  • Post category:AWK
  • Post comments:3 Comments
AWK - Environment

This topic is about AWK – Environment.

This chapter describes how to set up the AWK environment on your GNU/Linux system.

Installation Using Package Manager

Generally, AWK is available by default on most GNU/Linux distributions. You can use which command to check whether it is present on your system or not. In case you don’t have AWK, then install it on Debian based GNU/Linux using Advance Package Tool (APT) package manager as follows βˆ’

[jeryy]$ sudo apt-get update
[jeryy]$ sudo apt-get install gawk

Similarly, to install AWK on RPM based GNU/Linux, use Yellowdog Updator Modifier yum package manager as follows βˆ’

[root]# yum install gawk

After installation, ensure that AWK is accessible via command line.

[jerry]$ which awk

On executing the above code, you get the following result βˆ’

/usr/bin/awk

Installation from Source Code

As GNU AWK is a part of the GNU project, its source code is available for free download. We have already seen how to install AWK using package manager. Let us now understand how to install AWK from its source code.

The following installation is applicable to any GNU/Linux software, and for most other freely-available programs as well. Here are the installation steps βˆ’

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

In this topic we learned about AWK – Environment. To know more, Click Here.

This Post Has 3 Comments

Leave a Reply