Skip to content

Instantly share code, notes, and snippets.

@skrater
Created December 3, 2019 21:53
Show Gist options
  • Save skrater/d7f5a73948fac1978bcd8faa0b68dc91 to your computer and use it in GitHub Desktop.
Save skrater/d7f5a73948fac1978bcd8faa0b68dc91 to your computer and use it in GitHub Desktop.
use strict;
my $filename = $ARGV[0];
my $line = $ARGV[1];
open my $fh, '<', $filename or die "Can't open file $!";
my $file_content = do { local $/; <$fh> };
my $regex = qr/$line.*?(?=AUTO_INCREMENT=([0-9]+))/sp;
if ( $file_content =~ /$regex/ ) {
print $1;
}
print 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment