How to download awk to Ubuntu, since I tried to use asorti function and it told me that there is an error on this asorti. I tried many scripts that used asorti function and the same error occure!
2 Answers
It sounds like your system is using mawk to provide awk - you can check with
update-alternatives --display awkIf that is the case, you should be able to install GNU awk (gawk) from the repository either using the Software Center or other GUI package manager, or via the command line using
sudo apt-get update
sudo apt-get install gawkThis should automatically set your default awk to gawk using the update-alternatives mechanism - if you need to set it back to mawk you can do so by running
sudo update-alternatives --config awkand following the on-screen instructions. The asorti function is a GNU awk extension.
6You can also download the gawk source code files from and then proceed to compile them. This approach may be useful if you want to use a specific version of gawk other than the one provided by the gawk package in Ubuntu's repositories.
After downloading the source code, extract the files in a given directory /home/user/gawk/ and then:
cd /home/user/gawk
./configure
make
sudo make installMost probably it will be installed in something like /usr/local/bin/gawk-4.X.Y, being X and Y numbers that change on every new release.