#!/usr/bin/perl -w use strict; # Filter specific strings from an input file into specific files. { # Open input and output files. open ( INPUT, '<', 'html_LogFiles' ) or die "Unable to open input file: $!"; open ( BSC, '>', 'BSC' ) or die "Unable to open BSC: $!"; # Update: Sorry, got the names of these two wrong. # That's why copy and paste is bad, bad, bad. open ( SBSCSubsystem, '>', 'SBSCSubsystem' ) or die "Unable to open SBSCSubsystem: $!"; open ( MCBTSSubsystem, '>', 'MCBTSSubsystem' ) or die "Unable to open MCBTSSubsystem: $!"; # Process input lines into output files. Note that an # input line may match more than one pattern and # therefore may appear in more than one output file. while() { if ( /BSC-/ ) { chomp; my $copy = $_; $copy =~ s/BSC-//; print BSC "$_ $copy\n"; } if ( /SBSCSubsystem/ ) { chomp; my $copy = $_; $copy =~ s/SBSCSubsystem//; print SBSCSubsystem "$_ $copy\n"; } if ( /MCBTSSubsystem/ ) { chomp; my $copy = $_; $copy =~ s/MCBTSSubsystem//; print MCBTSSubsystem "$_ $copy\n"; } } # Close input and output files. close ( INPUT ); close ( BSC ); close ( SBSCSubsystem ); close ( MCBTSSubsystem );