HOWTO: use grep to transform company, address, phone, web into CSV format

Grep pattern for the day:

(.*)r(.*)r(.*), ([A-Z]*) ([0-9]*(-[0-9]*)?)r(P: (.*)r)?(F: (.*)r)?((.*@.*)r)?((www.*)r)?

This will take a list in the form of:

Company Name
City, State ZIP
P: 123-123-1234
F: 123-123-1234

where the phone, fax, email and website are all optional

and allow you to then reorder into a nice CSV format with a replace:


saving a LOT of time. Isn’t grep great?

, ,

sell diamonds