$ awk -F'\t' '{ print $NF }' <filename>
- This command will print the last field of each line, even if each line does NOT have
the same number of fields
Try the command on a file with the following content:
one
one(tab)two
one(tab)two(tab)three
one(tab)two(tab)three(tab)four
one(tab)two(tab)three(tab)four(tab)five
one(tab)two(tab)three(tab)four(tab)five(tab)six
Note: (tab) indicates a tab character
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.