Hey James,

I'm late to this party, but I wanted to see how fun it would be to do the job 
in Perl.

It turned out to be really simple:


#!/usr/bin/env perl -0777 -nsw
# 
--------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2012/11/27 08:12
# dMod: 2021/04/19 21:36 
# Task: Sort CC Script Segments for a Video.
# Tags: @ccstone, @Shell, @Script, @CC, @Sort, @Video
# 
--------------------------------------------------------------------------------
use v5.010;

s!^LOGGER\h*\d+\h*!!gim;        # Remove “Logger ##” lines if necessary.
s!\A\s+|\s+\Z!!;                # Remove leading and trailing vertical 
whitespace.
s!^\h+|\h+$!!gm;                # Remove trailing whitespace on every line.
my @array = split(/\n\s+/, $_); # Split script segments into an array.
chomp(@array);                  # Remove trailing linefeeds from records.
@array = sort(@array);          # Sort array.
$, = "\n\n";                    # Set Output Field Separator.
print @array;                   # Print array.


Save the script in:

~/Library/Application Support/BBEdit/Text Filters/<YourScriptName>.pl

Give it a keyboard shortcut in BBEdit's Menus & Shortcuts preferences – or 
activate it from the Text > Apply Text Filter menu.

Note:

script segments must have at least 1 blank line between them.

--
Best Regards,
Chris


> On 03/11/2021, at 15:39, ajames <[email protected] 
> <mailto:[email protected]>> wrote:
> 
> Complete novice here exploring an option for a workflow, thank you for the 
> help. Totally out of my area here.
> 
> Trying to combine on set television logging scripts into a master script. 2 
> seperate loggers concentrating on different talent, producing seperate 
> scripts e.g
> 
> LOGGER 1
> 
> [15:57:13.22]
> PRODUCER:
> WHERE ARE YOU FROM? 
> 
> [18:57:15:00]
> CONTESTANT 1:
> I'm from Austin Texas. Wait should I say........
> 
> [18:57:16.13]
> PRODUCER:
> I THINK YOU SHOULD SAY AUSTIN AS ONE. YOU ARE EARING A COBOYS HAT. 
> 
> [15:57:27:03]
> CONTESTANT 2:
> Or should I say both? I'm from Austin but I live in Vegas. 
> 
> LOGGER 2
> 
> [15:57:14.22] 
> PRODUCER 2:
> TELL ME, TELL ME.
> 
> [15:57:15.22] 
> CONTESTANT 2: 
> I run the junior program at my country club, I help with event set ups and I 
> do all the retail buying for the country club.
> 
> [15:57:20.22] 
> PRODUCER 2:
> CAN WE NOW PUT YOUR INTRO ALL TOGETHER? SO YOU'RE BASICALLY IN ONE THOUGHT 
> 'MY NAME'S CONTESTANT 2, I'M FROM CALIFORNIA AND THIS IS WHAT I DO.'
> 
> [15:57:31.22] 
> CONTESTANT 2: 
> Okay, um. I'm contestant 2, I'm from California and I'm a golf shop manager 
> in New York.
> 
> I need to sort by combine these scripts into a single document for our edit 
> software to read, but I need to keep the spacing and format of each small 
> block of text, just need to sort by time e.g.
> 
> [15:57:13.22]
> PRODUCER:
> WHERE ARE YOU FROM? 
> 
> [15:57:14.22] 
> PRODUCER 2:
> TELL ME, TELL ME.
> 
> [18:57:15:00]
> CONTESTANT 1:
> I'm from Austin Texas. Wait should I say........
> 
> [15:57:15.22] 
> CONTESTANT 2: 
> I run the junior program at my country club, I help with event set ups and I 
> do all the retail buying for the country club.
> 
> [18:57:16.13]
> PRODUCER:
> I THINK YOU SHOULD SAY AUSTIN AS ONE. YOU ARE EARING A COBOYS HAT. 
> 
> [15:57:20.22] 
> PRODUCER 2:
> CAN WE NOW PUT YOUR INTRO ALL TOGETHER? SO YOU'RE BASICALLY IN ONE THOUGHT 
> 'MY NAME'S CONTESTANT 2, I'M FROM CALIFORNIA AND THIS IS WHAT I DO.'
> 
> [15:57:27:03]
> CONTESTANT 2:
> Or should I say both? I'm from Austin but I live in Vegas. 
> 
> [15:57:31.22] 
> CONTESTANT 2: 
> Okay, um. I'm contestant 2, I'm from California and I'm a golf shop manager 
> in New York.

-- 
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 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/20FA4B04-D617-41A4-A324-7551AFE39AB8%40gmail.com.

Reply via email to