How to print the Nth column of a text file with AWK using argv December 4, 2023 by Tarik awk -v x=2 '{print $x}' or in a shell script: #!/bin/sh num=$1 awk < /tmp/in -v x=$num '{print $x}' > /tmp/out