• The awk command is a very general pattern matching facility.
  • One simple but useful capability is to pick out columns of text.
  • This is particularly handy for manipulating tabular information such as in stimulus files.

  • Syntax for selecting column N is:
      awk '{print $N}'

  • Note that the exact syntax (quotes and braces) must be used.
  • Example:
    $ v="im*.nii.gz"
    $ echo $v
      im1.nii.gz im2.nii.gz im3.nii.gz
    $ echo $v | awk '{print $2}'