From 2a0c0a3dbbdf7fa5040953c0b0d88ad6f62c011e Mon Sep 17 00:00:00 2001 From: Joachim Tingvold Date: Sun, 6 Apr 2014 03:11:04 +0200 Subject: Initial commit. Source; TG13-goodiebag. --- sql/strip.pl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 sql/strip.pl (limited to 'sql/strip.pl') diff --git a/sql/strip.pl b/sql/strip.pl new file mode 100644 index 0000000..51739a6 --- /dev/null +++ b/sql/strip.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl +use warnings; +use strict; + +my $ignore = "((([0-9a-f]{2}[:]){5}[0-9a-f]{2})|"; +$ignore .= "([0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{2}\:[0-9]{2}\:[0-9]{2})"; +$ignore .= ").*"; + +my $community = ""; + +my $skip = 0; + +open (SQL, $ARGV[0]) or die "Unable to open SQL-file"; +while () { + unless (/^$ignore$/){ + + if (/COPY (mbd_log|squeue|temppoll|ap_poll)/){ + $skip = 1; + print; + } + + if (/\\\./){ + $skip = 0; + } + + unless ($skip){ + s/$community//g; # community + s/PASSWORD '.+'/PASSWORD ''/g; # password for SQL-users + s/public$//; # public-community -- assuming last column + print; + } + } +} -- cgit v1.2.3