how to extract part of log

Simple perl script below gets as arguments
1. Start pattern (could be regexp in single quotes)
2. End pattern (could be regexp in single quotes)
3. File path

It is opening file and prints  everything between Start and End pattern.

<code>

#!/usr/bin/perl

die “Usage: start_pattern end_pattern file [$#ARGV]” if $#ARGV<2;

open FI, $ARGV[2] || die “Problem with opening file [$ARGV[2]] [$!]\n”;
$START=$ARGV[0];
$END=$ARGV[1];

$in=0;
foreach (<FI>) {
        $in=1 if /$START/;
        print $_ if $in;
        $in=0 if /$END/;

}
close FI;

</code>

rozmowy z kolegami

kaalai vanakkam  – dzień dobry po tamilsku. To w zapisie angielskim. Właściwie oznacza to good morning.

CURL and no Cache test throgh proxy

 

i=0; while true; do let i=$i+1; curl  -H “Pragma: no-cache”  -H “Cache-Control: no-cache” -I -x proxy_host:proxy_port http://site_to_be_tested/index.html; echo  $i; sleep 1; done