Using nawk, how to print the first names for all those in the 916 area code?

-1

Possible Duplicate:
Using nawk, how to print all first names containing four characters?

Using nawk, how to print the first names for all those in the 916 area code? I've tried nawk ‘$3 ~ /(916)/{print $1}’ inputfile but didn' work.

Jody Savage:(206) 548-1278:15:188:150

Guy Quigley:(916) 343-6410:250:100:175

Dan Savage:(406) 298-7744:450:300:275

Nancy McNeil:(206) 548-1278:250:80:75

John Goldenrod:(916) 348-4278:250:100:175

Chet Main:(510) 548-5258:50:95:135

Steve

Posted 2012-10-17T17:21:23.857

Reputation: 287

Question was closed 2012-10-17T18:38:23.143

3I really hope these are not real phone numbers and the real names of these people. – Ramhound – 2012-10-17T18:01:20.717

Answers

1

Try this :

nawk '$2 ~ "(916)" {print}' file.txt

Gilles Quenot

Posted 2012-10-17T17:21:23.857

Reputation: 3 111

You should "accept" the question then =) (Dunno if it's possible with a closed question) – Gilles Quenot – 2012-10-17T20:08:42.480