Hello,

I have a data file that has names of varying lengths that are listed in columns. ie:

Ranjit Singh        Dean Johnson   
Ken Whillans       Karen Thompson 
Peter Robertson  Rich Gardener  
Sandeep Jain      Ken Whillans   
John Thompson   Cher           
Cher                 Karen Patel    
John Jacobs       Davinder Singh 
Dean Johnson     Sandeep Jain   
Karen Thompson John Thompson  
Rich Gardener     Peter Robertson
Karen Patel        Ranjit Singh

I'm trying search the left column and print out the corresponding with it on the right. i.e A search for 'ohn' would only print out:

John Thompson   Cher 
John Jacobs       Davinder Singh 
Dean Johnson     Sandeep Jain

(All the names should be in perfect column columns with the first letters lining up with each other)

I've tried cutting each into temp files and grep'ing those files, but I can't find out a way to only output the info that I want.

Any help would be appreciated.

so you want this output

John Thompson   Cher 
John Jacobs       Davinder Singh 
Dean Johnson     Sandeep Jain

to look like this

John Thompson   Cher 
John Jacobs     Davinder Singh 
Dean Johnson    Sandeep Jain

so you want this output

John Thompson   Cher 
John Jacobs       Davinder Singh 
Dean Johnson     Sandeep Jain

to look like this

John Thompson   Cher 
John Jacobs     Davinder Singh 
Dean Johnson    Sandeep Jain

Well yes. That would be the result of searching for "ohn".

I want to search the left column for something, and print out all rows that contain the search string in the left column.

This article has been dead for over six months. Start a new discussion instead.