Forum Discussion
hwidjaja_37598
Dec 28, 2009Altostratus
Try using perl, cut and paste this code to a file (eg. /tmp/mygrep.pl) and make sure the executable bit is set (eg. chmod a+x /tmp/mygrep.pl)
!/usr/bin/perl
use strict;
my ($File, $Pattern) = @ARGV;
my $buf;
open (fh, $File) || die "Cant open $File";
{
local $/;
$buf=;
}
close (fh);
while ($buf =~ /([^\n]*\{[^\{]*$Pattern[^\}]*\})/sg){
print "$1\n---\n";
}
Sample:
[root@bigip:Active] config /tmp/mygrep.pl /config/bigip.conf http-xff
virtual vip1.80 {
pool vip1.80
destination aaa.bbb.ccc.ddd:http
ip protocol tcp
rules SNAT2VIP
profiles
http-xff
tcp-lan-optimized
serverside
tcp-wan-optimized
clientside
persist source_addr_30min
}
---
virtual vip-2.80 {
pool vip-2.80
destination mmm.nnn.ooo.ppp:http
ip protocol tcp
rules SNAT2VIP
profiles
http-xff
tcp-lan-optimized
serverside
tcp-wan-optimized
clientside
persist source_addr_30min
}
---
[root@bigip:Active] config /tmp/mygrep.pl /config/bigip.conf password
user root {
password crypt "[cut]"
}
---
user admin {
password crypt "[cut]"
description "Admin User"
group [cut]
home "[cut]"
shell "[cut]"
role administrator in all
}
---
user f5emsvr {
password crypt "[cut]"
description "F5 EM Service Account"
id [cut]
group [cut]
home "[cut]"
shell "[cut]"
role guest in all
}
---
configsync {
password crypt "[cut]"
}
---
It's not well tested, use it at your own risk and on dev machine first.