Hi Howard,

Try a Text Filter.

Here's one in Perl.

###### Save in a file
#!/usr/bin/perl

use strict;
use warnings;
my %names;
while (<>) {
    my $name; ($name) = /From ([^:]+?)\s+:/;
    $names{$name}++;
}

for my $n (sort keys %names) {
    printf qq{%s\t%d\n} => $n, $names{$n};
}
#####

Save this as a BBEdit Text Filter, with a recognizable name such as count_names.pl; the standard location for Text Filters is:
~/Library/Application Support/BBEdit/Text Filters/

Then you'll see  it in BBEdit under Windows -> Palettes -> Text Filters.

Just have your data file open and frontmost, then pick this from the Text Filters palette; you can assign it a keyboard combo if you want.

You could also run it from the command line, with your data file as the argument.

Happy to explain the script if that helps.

HTH

On 10/6/20 at 11:23 AM, leadwithlo...@gmail.com (Howard) wrote:

I have the following data (shown below). I want to count how many times each of the four names appear (Harvey Haney, Apple Jones, Banana Herb, Sam Blue). Can this be done in BBEdit? If not, I would appreciate suggestions on how it can be done.

10:45:57 From Harvey Haney : Good morning. How is everyone today?
10:46:08 From Apple Jones : I'm doing good. How are you?
10:46:12 From Banana Herb : Good how are you!
10:46:18 From Sam Blue : I'm doing fine. How are you?
10:45:57 From Harvey Haney : Good morning. How is everyone today?
10:46:08 From Harvey Haney : I'm doing good. How are you?
10:46:12 From Apple Jones : Good how are you!
10:46:18 From Sam Blue : I'm doing fine. How are you?
10:45:57 From Harvey Haney : Good morning.

--

  - Bruce

_bruce__van_allen__santa_cruz__ca_

--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "supp...@barebones.com" rather than posting here. 
Follow @bbedit on Twitter: <https://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 bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/r480Ps-10146i-D180823581C54870884A66021AC1C89B%40Forest.local.

Reply via email to