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

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
Address
City, State ZIP
P: 123-123-1234
F: 123-123-1234
email@example.com
www.example.com

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

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

"","1","2","","3","4","56","8","10","12","14"r

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

Comments are closed.
sell diamonds