Using grep and expressions
How can I use grep expressions so that i can find strings like the ones bellow:
New York, NY
As you can see each city starts with capital letter then it follows up with a comma, and then with the Abbreviation of the city.
I used :
grep -w '[A-Z][a-zA-Z]*[,][ ]*[A-Z][A-Z]' <FILENAME> works for me.
I'm no regex expert so it could probably be refined a bit.
If you want to match one uppercase letter, and the rest of the city name must be lowercase:
grep -w '[A-Z].[a-z]*[,][ ]*[A-Z][A-Z]' <FILENAME> seems to work
You are a life saver... :P
|All times are GMT -5. The time now is 03:17 PM.|