Lecture 6


More gawking and other useful tricks


Sorting with gawk

  • Try the above awk scripts on your own. The easiest thing to do is to open a file using vim, say try.awk , then switch to the insert mode (esc i), and copy and paste any of the above scripts into the file. Depending on your machine's set up, pasting is done by clicking the middle button of your mouse, or right and left at the same time. ctrl p may also work. Do not forget to add the following line on top: #!/usr/bin/gawk -f Also, do chmod +x try.awk

  • sort: a better sort

    UNIX sort is a very powerful command, for instance:


    find: searching for files

    UNIX find is a powerful utility to search for files (i.e., names of files, not file contents, which is what you use egrep for).

    Return Home