cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor
Starfighter Starfighter
Starfighter
  • 53 Views

awk Tip - #4

 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

 

 

Trevor "Red Hat Evangelist" Chandler
Labels (3)
0 Replies
Join the discussion
You must log in to join this conversation.