On Mon, Apr 19, 2010 at 09:58:42PM -0400, Ronald J Kimball wrote:
> You would have to run this from the command line, specifying the name of
> the source file. If you want a script you can run from within BBEdit, I
> can work on that when I have a bit more time.
I realized I was overthinking it a bit...
#!perl
my @lines;
while (<>) {
if (/a string/) {
print @lines;
}
push @lines, $_;
shift @lines if @lines > 700;
}
__END__
Read from STDIN, print from STDOUT. You can run this from the command line
like this:
perl find_a_string.pl input.txt > output.txt
Or save it to BBEdit's Unix Filters folder, and you can run it within
BBEdit on the current selection. Hold down Command as you run it to set
the filter options, and you can have it write the output to a new window.
Ronald
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.