in reply to perl and awk
I believe you might benefit from reading What is the simplest way to print a field, as in $3 does in awk.
HTH,