Re: Counting occurrences of names

2020-10-10 Thread @lbutlr
On 07 Oct 2020, at 08:10, Rod Buchanan wrote: > cut -d' ' -f3-4 | sort | uniq -c And, since there are many way to do this, I generally fall back to awk awk '{print $3, $4}' | sort | uniq -c Which does exactly the same thing. -- showing snuffy is when Sesame Street jumped the shark -- This

Re: Counting occurrences of names

2020-10-08 Thread Rod Buchanan
Add: | sort -k 1nr,2 To the end of the UNIX command, i.e. cut -d' ' -f3-4 | sort | uniq -c | sort -k 1nr,2 ’-k 1nr’ says sort the first field numerically in reverse order, then sort on the second field ‘2’ Again, “man sort” for more info. -- Rod > On Oct 8, 2020, at 6:54

Re: Counting occurrences of names

2020-10-08 Thread Howard
Rod, Your explanation is very helpful. Here is the result your code yields: 2 Apple Jones 1 Banana Herb 4 Harvey Haney 2 Sam Blue What if I want the output displayed like this: (How would I get that?) 4 Harvey Haney 2 Apple Jones 2 Sam Blue 1 Banana Herb Thus, the names

Re: Counting occurrences of names

2020-10-07 Thread Rod Buchanan
-d’ ’ tells cut to use the space character as the column/field delimiter. -f3-4 tells it to only return columns/fields 3 and 4. >From the man page. (Type “man cut” in Terminal.app for complete info.) cut -- cut out selected portions of each line of a file. SYNOPSIS cut -f list [-d

Re: Counting occurrences of names

2020-10-07 Thread Howard
Rod, What does the line below do? cut -d' ' -f3-4 Howard On Wednesday, 7 October 2020 at 10:11:31 am UTC-4 Rod Buchanan wrote: > > Click Text -> Run Unix Command… , then run this: > > cut -d' ' -f3-4 | sort | uniq -c > > When I copy/paste your data I get these results: > >2 Apple Jones >

Re: Counting occurrences of names

2020-10-07 Thread Rod Buchanan
Click Text -> Run Unix Command… , then run this: cut -d' ' -f3-4 | sort | uniq -c When I copy/paste your data I get these results: 2 Apple Jones 1 Banana Herb 4 Harvey Haney 2 Sam Blue -- Rod -- Rod > On Oct 6, 2020, at 1:23 PM, Howard wrote: > > I have the

Re: Counting occurrences of names

2020-10-06 Thread Tom Robinson
But that pattern already finds lines ending with a question mark… > On 2020-10-07, at 15:26, Howard wrote: > > How can I revise the pattern below so that I can also find all the lines that > end with a question mark? > > Pattern: ^.*From (.*?) :.*$ > Replace: \1 If you mean only a question

Re: Counting occurrences of names

2020-10-06 Thread Howard
fletcher, Thanks for the quick response. I used Pattern: ^.*From (.*?) :.*$ Replace: \1 to create a file, then saved it as a text file, and imported that into R where I use the table function to get the output I needed. Howard On Tuesday, 6 October 2020 at 2:42:38 pm UTC-4

Re: Counting occurrences of names

2020-10-06 Thread Howard
Harvey, What you suggested sounds great; however, I have no idea how to write or run a Node JS script. Howard On Tuesday, 6 October 2020 at 2:46:38 pm UTC-4 Harvey Pikelberger wrote: > You would probably be better of trying to tackle this with a spreadsheet > and a couple of calculated

Re: Counting occurrences of names

2020-10-06 Thread Howard
jajls, I just tried your solution. It is very easy to use. Thanks, Howard On Tuesday, 6 October 2020 at 3:44:13 pm UTC-4 jajls wrote: > On 2020 Oct 6, at 14:42, Fletcher Sandbeck wrote: > > > I'd do this in two steps. > > > Simplifying on Fletcher's solution, and staying in BBEdit: > > Use

Re: Counting occurrences of names

2020-10-06 Thread Howard
How can I revise the pattern below so that I can also find all the lines that end with a question mark? Pattern: ^.*From (.*?) :.*$ Replace: \1 On Tuesday, 6 October 2020 at 2:42:38 pm UTC-4 fletc...@cumuli.com wrote: > I'd do this in two steps. First, isolate all the names using a >

Re: Counting occurrences of names

2020-10-06 Thread Howard
Hi Craig, Thanks for the solution. I plan to try it. Howard On Tuesday, 6 October 2020 at 3:06:28 pm UTC-4 Craig W Johnson wrote: > There may be a better way, but what I would do is open up a search window, > enter your target name in the find field, enter “\1\r” in the replace > field, and

Re: Counting occurrences of names

2020-10-06 Thread Howard
Bruce Van Allen, Thanks for the PERL solution. I'm new to PERL, but plan to try your solution. It looks quite interesting. Howard On Tuesday, 6 October 2020 at 3:45:51 pm UTC-4 Bruce Van Allen wrote: > Hi Howard, > > Try a Text Filter. > > Here's one in Perl. > > ## Save in a file >

Re: Counting occurrences of names

2020-10-06 Thread Bruce Van Allen
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}; } #

Re: Counting occurrences of names

2020-10-06 Thread 'Jeffrey Jones' via BBEdit Talk
On 2020 Oct 6, at 14:42, Fletcher Sandbeck wrote: > > I'd do this in two steps. Simplifying on Fletcher's solution, and staying in BBEdit: Use Find and Extract as Fletcher describes. Don't bother to save the file or go into Terminal. Instead, use Text > Run Unix Command… Enter the command:

Re: Counting occurrences of names

2020-10-06 Thread Craig W. Johnson
There may be a better way, but what I would do is open up a search window, enter your target name in the find field, enter “\1\r” in the replace field, and then hit extract. Every instance hit will then be on its own line, and, presuming you have line numbering enabled, you could just check

Re: Counting occurrences of names

2020-10-06 Thread MediaMouth
You would probably be better of trying to tackle this with a spreadsheet and a couple of calculated columns. If it's an ongoing tally you want to maintain and / or the dataset it too big for a spreadsheet, consider a database. But the fastest immediate solution: Use BBEdit not to do the

Re: Counting occurrences of names

2020-10-06 Thread Fletcher Sandbeck
I'd do this in two steps. First, isolate all the names using a search/replace with the following pattern with "Grep" turned on. Use the "Extract" button to create a new file. Pattern: ^.*From (.*?) :.*$ Replace: \1 That gives you a file with just the names in it on separate lines. Harvey

Counting occurrences of names

2020-10-06 Thread Howard
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