Scripting Question

Patton Echols p.echols at comcast.net
Sat Feb 14 02:18:03 UTC 2009


I have a fairly massive flat file, comma delimited, that I want to 
extract info from.  Specifically, I want to extract the first and last 
name and email addresses for those who have them to a new file with just 
that info. (The windows database program that this comes from simply 
will not do it)  I can grep the file for the @ symbol to at least 
exclude the lines without an email address (or the @ symbol in the notes 
field)  But if I can figure this out, I can also adapt what I learn for 
the next time.  Can anyone point me in the right direction for my "light 
reading?"

By the way, I used 'head' to get the first line, with the field names.  
This is the first of about 2300 records, the reason not to do it by hand.

patton at laptop:~$ head -1 contacts.txt
"Business Title","First Name","Middle Name","Last Name","","Business 
Company Name","","Business Title","Business Street 1","Business Street 
2","Business Street 3","Business City","Business State","Business 
Zip","Business Country","Home Street 1","Home Street 2","Home Street 
3","Home City","Home State","Home Zip","Home Country","Other Street 
1","Other Street 2","Other Street 3","Other City","Other State","Other 
Zip","Other Country","Assistant Phone","Business Fax Number","Business 
Phone","Business 2 Phone","","Car Phone","","Home Fax Number","Home 
Phone","Home 2 Phone","ISDN Phone","Mobile Phone","Other Fax 
Number","Other Phone","Pager 
Phone","","","","","","","","","","","","","Business Email","","Home 
Email","","Other 
Email","","","","","","","","","","","","Notes","","","","","","","","","","","","","","Business 
Web Page"





More information about the ubuntu-users mailing list