ACC SHELL

Path : /usr/lib/YaST2/bin/
File Upload :
Current File : //usr/lib/YaST2/bin/cut-messages

#!/usr/bin/perl -w

# Author: Arvin Schnell

$infile = "/var/log/messages";

if (!open (FILE, $infile)){
    die "error: can't read `$infile': $!\n";
}

$takeit = 0;
@lines = ();

while (<FILE>)
{
    $pos = index ($_, " ", 16);
    $_ = substr ($_, $pos + 1);

    if (/^[a-z]+: BEGIN OF YAST2 INTERNET TEST$/)
    {
	$takeit = 1;
	@lines = ();
    }

    if ($takeit)
    {
	push (@lines, $_);
    }

    if (/^[a-z]+: END OF YAST2 INTERNET TEST$/)
    {
	$takeit = 0;
    }
}

foreach $line (@lines)
{
    print "$line";
}

ACC SHELL 2018