Scripting Question

Lucio M Nicolosi lmnicolosi at gmail.com
Sat Feb 14 02:44:25 UTC 2009


Patton Echols wrote:
> 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"
>
>
>   
Sure it's not an elegant solution, but couldn't you just import the 
comma delimited data to a worksheet and edit it? OpenOffice or Symphony 
would do it.

L.

-- 
Lucio M. Nicolosi, Eng.
São Paulo - Brazil
Lat.:  23°34'4.79"S
Long.: 46°39'59.53"W

email: lmnicolosi at gmail.com
skype: lmnicolosi1

Linux Registered User #481505
http://counter.li.org/







More information about the ubuntu-users mailing list