AWK Environment - AWK

What is AWK Environment?

This tutorial on AWK Environment explains on how to set up the AWK environment on our GNU/Linux system.

Installation Using Package Manager

Usually , AWK will be available by default on most of the GNU/Linux distributions. We can use certain commands to check whether it is present on our system or not. For suppose, if we don’t have AWK built in our system, then install it on Debian based GNU/Linux using Advance Package Tool (APT) package manager as stated below−

Similarly, to install AWK on RPM based GNU/Linux, we need to use Yellowdog Updator Modifier yum package manager as below−

After installation, make sure that AWK is accessible via command line.

On executing the above code, we will get the below result −

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 earlier. Let us learn on how to install AWK from its source code.

The below installation steps are applicable to any GNU/Linux software, and for most other freely-available programs as well.

Stated below are the installation steps −

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

  • Step 2 − Next, Decompress and extract the downloaded source code.

  • Step 3 − Now, Change into the directory and run configure.

  • Step 4 − Once after the successful completion, the configure generates Makefile. To compile the source code, we need to issue a make command as below.

  • Step 5 − We can run the test suite to ensure the build is clean. This step can be followed or can be left as an optional step.

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

There We go! We have successfully compiled and installed AWK. We can now verify it by executing the awk command as below−

On executing this code, We will get the below result −

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

AWK Topics