On 08/28/2018, at 19:05, Elliott Balsley <[email protected]
<mailto:[email protected]>> wrote:
> I'm trying to do a grep search in a large document and it fails with error
> 12182, even for the simplest pattern like a plain word with no regex
> characters. Regular text search works. This is a MySQL log file that's a
> little over 3GB. Search works on smaller documents, like 2GB. Is there any
> workaround for this?
Hey Elliott,
This sounds like something you should report to Bare Bones Support (see the
footer of any given message).
In lieu of other solutions I'd try a Perl script.
It needs the file-to-be-searched to be selected in the Finder.
Presently it prints the entire line where the pattern is matched, but that can
easily be changed to return 1 or more capture groups.
(If your regular expression spans more than 1 line then you need a different
solution.)
Look for “Your regular expression goes here:” in the script and change the
pattern as needed.
You can run this directly from a BBEdit text document, or you can install it in
the Script Menu folder and run from the Script Menu directly or with an
assigned keyboard shortcut.
~/Library/Application Support/BBEdit/Scripts/<yourScriptName>.pl
#!/usr/bin/env perl -sw
use v5.12;
#
-----------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2018/08/29 22:08
# dMod: 2018/08/29 22:06
# Task: Search a selected file in the Finder with Perl.
# Tags: @ccstone, @Shell, @Script, @Search, @Selected, @File, @Finder, @Perl
#
-----------------------------------------------------------------------------------------
# Your regular expression goes here: '<regex>'
my $rePattern = '^.*9999.*';
#
-----------------------------------------------------------------------------------------
# Get the POSIX Path of the selected file in the Finder.
my $filePath = `
read -r -d '' asCmdStr <<'EOF'
tell application "Finder" to set finderSelectionList to selection as alias
list
if length of finderSelectionList = 0 then error "No files were selected in
the Finder!"
set theItem to item 1 of finderSelectionList
return POSIX Path of theItem
EOF
osascript -e "\$asCmdStr"
`;
open ( MYFILE, $filePath ) or die $!;
while (<MYFILE>) {
if ( m/$rePattern/ ) {
say $&;
}
}
close (MYFILE);
#
-----------------------------------------------------------------------------------------
--
Best Regards,
Chris
--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.