On 28 Sep 2021, at 19:04, Kim Mosley <[email protected]> wrote:

> I'm looking for a grep pattern to put this data into 5 columns (though there 
> is no data for the "tags" column). Hopefully I can paste it into Excel. Now 
> it just goes into one column.

Save this script as xx.pl in
"~/Library/Application Support/BBEdit/Text Filters/",
bring your document to the front and run the filter from the palette (Menu: 
Window::Palettes::Text Filters.)

If you want to see the output without modifying the file, run the same script 
from the Scripts palette after saving it in the .../BBEdit/Scripts folder; 
otherwise just undo the work of the filter.


#!/usr/bin/perl
my $counter = 0; my $max = 5;
while (<>) { #read rows in succession
        $counter++;
        chomp; #remove linefeed
        print "\t" if $counter == 4 && $max == 4; #skip a column
        print; #add contents to column
        if ($counter < $max) {
                print "\t";
        } else { #start a new row
                print $/;
                $counter = 0;
                $max = 4; #allow for the missing tags data
        }
}
#END

Let us know if there's any problem.

JD


-- 
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/A1E07F6D-53F4-4581-B0EA-875478FDB47A%40gmail.com.

Reply via email to