change case in bbedit
January 19, 2009 11:20 AM

I have a .csv of names and email addresses in the format: email,firstname,lastname. Some of the names are in ALL CAPS, some are Properly Capitalized. Is there a way to fix the ALL CAPS names in one fell swoop using BBEdit? I'm not a grep/regex guy, so I appreciate your help.
posted by griseus to Computers & Internet (10 answers total) 1 user marked this as a favorite
In Excel you can use =PROPER(A1). If JONES is in cell A1 it will turn JONES into Jones.
posted by Frank Grimes at 11:34 AM on January 19, 2009


as someone who works with a lot of data like this, i'd reccomend that you go to the ALL CAPS format before the Properly Capitalized. It will save you work in the end.
posted by lester's sock puppet at 11:38 AM on January 19, 2009


@Frank Grimes, that'll do the job, thanks.

@lester's sock puppet, thanks for the advice. In this particular case, I need the Properly Capitalized; we're not doing any analysis, just exporting for an email list (a nonprofit...not spam, I promise!). I'm curious, though: why is ALL CAPS better in the end?
posted by griseus at 11:43 AM on January 19, 2009


Yes you can! Here's one example.

Here's the search pattern:

^(.+?),(.)(.*?),(.)(.*?)$

Here's the replace pattern:

"\1", "\U\2\L\3", "\U\4\L\5"

Something like that.

Which should take:

foo@bar.com,JOHN,smith

And convert it into:

"foo@bar.com", "John" ,"Smith"

However this will not help with names like McDonald or double (or triple) barreled names.
posted by schwa at 11:46 AM on January 19, 2009


In BBEdit under the Text menu one of the first items is "Change case..."
posted by mikel at 11:48 AM on January 19, 2009


I'm guessing lester's sock puppet is suggesting ALL CAPS for sorting and name camparison purposes.
posted by schwa at 11:48 AM on January 19, 2009


mikej - the change case will do the whole documention (or selection) in one fell swoop. That's potentially overkill.
posted by schwa at 11:49 AM on January 19, 2009


It will do a selection as well but you're right that in a CSV it can be a little hairy to get the right text selected. I would strongly recommend a Regex approach, personally, which I see has been flagged already as best answer.
posted by mikel at 11:52 AM on January 19, 2009


FYI, The Proper() function in Excel will also mess up names like McDonald.
posted by Pants! at 12:02 PM on January 19, 2009


sorting is part of it. also, not every name is going to be properly capitalized by your program. some dutch and spanish names with prefixes (like 'VonBraun and de la Torrez) will be messed up, and you'll have to edit them by hand to make them accurate. might be ok if your list is small, but gets tedious when you have more then 50 or so. also, using all caps in data entry mode reduces keystrokes and potential errors. overall, you will spend a lot less time getting everything to match a all caps format then anything else, and it still will have the uniform appearance you desire.

these are email addresses, not display names. the proper database way is to create a new field for their names liked to the email address. you say you need it 'properly capitalized' to send out email? that's news to me.
posted by lester's sock puppet at 12:25 PM on January 19, 2009


« Older Are there any effective birth control pills.   |   Looking for a hard drive adapter/box for an IBM... Newer »
This thread is closed to new comments.