Sounds like a job for Perl -- you can run it native on Mac shell https://learn.perl.org/installing/osx.html Rough code: Input is original name list, output is CSV file. while(<>) { chomp; $name = $_; <>; chomp; if(m!^\(413\)!) { $phone = _; <>; chomp; } else { $phone = ""; # 2 quotes with no spaces } $addr = $_; $addr =~ s!Greenfield 01301!!; # This name fname/lname split will not work with multi-part lastnames # note: " " below are "(space)" @nameParts = split(" ", $name); $lname = pop($name); $fname = join(" ", @$name); print qq!$fname,$lname,$phone,$addr,Greenfield,01301\n!; } Good luck - Rich On 10/21/2017 4:34 AM, David Greenberg wrote: > I have a hard copy list of names, addresses and phone numbers. I can > scan to PDF and then copy and paste to a text editor (BBEdit) or other > file. I then need to manipulate the text so that I end up with a csv > file that can be opened by a spreadsheet program. Tools that I have at > my disposal include BBEdit (with Grep), a MAMP stack, NeoOffice (Mac > version of OpenOffice) and FileMaker. > > Input looks like this: > > John Doe > (413) 111-1111 > 123 First St Greenfield 01301 > Jane Smith > 456 So Main Ln Greenfield 01301 > Jane Ann Smith > (413) 222-2222 > 78 Main Ct Greenfield 01301 > > Note that all addresses will include 'Greenfield 01301' and, /if /the > data includes a phone number, it will start with '(413)'. > > Output should look like this: > > John,Doe,(413) 111-1111,123 First St,Greenfield,01301 > Jane,Smith,,456 So Main Ln,Greenfield,01301 > Jane Ann,Smith,(413) 222-2222,78 Main Ct,Greenfield,01301 > > Any suggestions greatly appreciated. Thanks. > > David > > > _______________________________________________ > Hidden-discuss mailing list - home page: http://www.hidden-tech.net > Hidden-discuss at lists.hidden-tech.net > > You are receiving this because you are on the Hidden-Tech Discussion list. > If you would like to change your list preferences, Go to the Members > page on the Hidden Tech Web site. > http://www.hidden-tech.net/members -- Rich Roth Webmaster/Steering Committee Member Hidden-tech http://www.hidden-tech.net The Talent you need is right here, Join and share your skills ((Sponsored by Thrives Media)) http://www.thrivesmedia.com http://www.welovemuseums.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.hidden-tech.net/pipermail/hidden-discuss/attachments/20171021/5648e398/attachment.html