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

awk Tip - #2

awk  -F'\t'   '/Texas/  { print $4 }'  filename

The above command print each line in filename, that contains the
word "Texas".   Each field of information is separated by a tab
character. 

Try the command on a file with the following content:

South(ab)Houston(tab)Texas(tab)77004
West(tab)Los Angeles(tab)California)(tab)98001
North(tab)Detroit(tab)Michigan(tab)48127
South(tab)El Paso(tab)Texas(tab)79904
East(tab)Charlotte(tab)North Carolina(tab)28201

 

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