Grep on a specific field and print results. NO AWK!!
Posted on 2004-10-03
I'm trying to use grep to search for a string in a table. However I need to limit the search to a specific field as I dont want any results from the first field if it contains the string. Then I need to print a few of the fields from the lines that contain my string in the field I need to search on. Here's an example of my data:
Toteve Sam Denver
Denver John Aspen
Ellis Joe Witchita
Toms Mary Denver
I want to search column 3 for Denver, but not pick up the John Denver line as I'm only searching column 3. It's easy in awk, but I cant use awk... Do I use Grep....I dont see how I can use Grep.