On 04/01/2019, at 10:59, Lee Hinde <[email protected]
<mailto:[email protected]>> wrote:
> I have a CSV file where the 2nd column contains names that are being provided
> all caps. I'd like to title case that column.
>
> First column is a number, always, so:
>
> 123,HUMAN RESOURCES,....
> 124,PUBLICATIONS,....
>
> I'd like to convert that to:
>
> 123,Human Resources,....
> 124,Publications,....
>
> Is that doable with RegEx? A quick google didn't provide anything I
> understood. (low bar)
Hey Lee,
I've made a feature suggestion to add select contiguous columns to the BBEdit's
edit columns suite.
If you're interested in same then it would help for you (and others) to make
the same request.
Were this possible it'd be a simple 2-step process to complete the task with
BBEdit.
I can't think of a way to do what you want with pure RegEx, but a little Perl
in a Text Filter goes a long way:
#!/usr/bin/env perl -sw
use v5.12;
use utf8;
my ($col2);
while (<>) {
if ( m!^([^,]+,)([^,]+)(,.+)?! ) {
$col2 = $2;
$col2 = join '', map { ucfirst lc $_ } split /(\s+)/, $col2;
print "$1$col2$3\n";
} else {
print;
}
}
--
Best Regards,
Chris
--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.