On Jan 05, 2022, at 14:15, David G Wagner <[email protected]> wrote:
> I have data in one file and in one window. I could write a Perl script, but
> was wanting to handle within BBEdit via filter or ?
Hey David,
A Perl script can be employed as a text filter, and that's probably as simple
as anything.
~/Library/Application Support/BBEdit/Text Filters/<Your Filter>
#!/usr/bin/env perl -sw
#
-----------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2022/01/06 06:35
# dMod: 2022/01/06 06:35
# Task: Number Lines Based On A Condition.
# Tags: @ccstone, @Shell, @Script, @Number, @Lines, @Condition, @bbedit-talk,
@David_Wagner
#
-----------------------------------------------------------------------------------------
my $cntr = 0;
while (<>) {
if (/#Start#/) {
$cntr++;
}
if (/^\d+\h+/) {
s!^\d+!$cntr!;
}
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 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/AAE234A6-24A5-479F-B6C8-F43442453CF6%40gmail.com.