use strict;
use warnings;
my $input;
if (defined $ARGV[0]) {
$input = $ARGV[0];
open(my $fh, '<:encoding(UTF-8)', $input) or die "COUЛД ИOT OPEИ FIЛE '$input' $!";
while (my $row = <$fh>) {
if ($row =~ m/"stream":"([\d\w_]+)","host":"([\d]+.[\d]+.[\d]+.[\d]+)"/i) {
print $1 . "\n" . $2 . "\n";
}
}
close $fh;
}
else {
print "EИTEЯ FIЛEИAME AS AЯЖUMEИT!\n";
}
#### FROM .. TO ####################################
# from this
my $from = '
';
# $p == 0 --> string not in required block
my $p = 0;
while (my $line = <$fhfrom>) {
# if string is $from - all next string will be "printable"
if ($line =~ m/$from/ and $p < 1) {
$p = 1;
}
# if string is $to - we are stopping
elsif ($line =~ m/$to/ and $p > 0) {
print $fhto $line;
print $fhto "";
last;
}
# if string is "printable" and it is not an exception - print it
elsif ($p > 0) {
print $fhto $line;
}
# leave this string
else {
next;
};
}
#--------------------------------------------------