Created
September 17, 2010 03:40
-
-
Save joet3ch/583632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
#Parser | |
use warnings; | |
use strict; | |
my $output_filename='output_parser.log'; #file where you want the output | |
die "\n\t$output_filename file already exists!\n\n" if (-e $output_filename); | |
sub output { | |
open OUTPUTFILE, ">> $output_filename"; | |
print OUTPUTFILE "$_\n"; | |
} | |
my @input_file=<>; | |
chomp @input_file; | |
print "\n\n\tParsing file now ...\n"; | |
my $counter=0; | |
foreach (@input_file) { | |
$counter++; | |
print "\t\tLine #$counter\n"; | |
my $line=$_; | |
if (/CABLE/i) { # input the regex to match here! | |
&output($1); | |
} | |
} | |
print "\n\nFinished! (Check the file $output_filename for the results)\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment