$ col() { awk '{print $('$(echo $* | sed -e s/-/NF-/g -e 's/ /),$(/g')')}'; } ExplanationA slightly improved version of the original one-liner to allow negative indexes to extract columns relative to the end of the line, for example:
In this example the function expands to:
|