#!/usr/bin/perl -w use strict; use warnings; ## Open I/P File "bsm1_LogFiles" for reading. open(INPUT,'<','bsm1_LogFiles') or die $!; ## Read from the Input File. my $line = ; ## Open the O/P File "BSC" for writing. open(BSC,'>','BSC') or die $!; ## Open the O/P File "SBSCSubsystem" for writing. open(SBSCSubsystem,'>','SBSCSubsystem') or die $!; ## Open the O/P File "MCBTSSubsystem" for writing. open(MCBTSSubsystem,'>','MCBTSSubsystem') or die $!; ## Search each Line in the Input File. for my $searchline() { ## Search for parameter 'BSC-'. if( $searchline =~ /BSC-/) { ## Read a line,copy it,& delete 'BSC-' in copy. chomp; my $copy = $_; $copy =~ s/BSC-//; ## Print the original line and the copy. print "$_ $copy\n"; ## Write to the Output File 'BSC'. my $line = 'BSC'; print BSC $searchline; } ## Search for parameter 'SBSCSubsystem-'. if( $searchline =~ /SBSCSubsystem-/) { ## Read a line,copy it,& delete 'SBSCSubsystem-' in copy. chomp; my $copy = $_; $copy =~ s/SBSCSubsystem-//; ## Print the original line and the copy. print "$_ $copy\n"; ## Write to the Output File 'SBSCSubsystem'. my $line = 'SBSCSubsystem'; print SBSCSubsystem $searchline; } ## Search for parameter 'MCBTSSubsystem-'. if( $searchline =~ /MCBTSSubsystem-/) { ## Read a line,copy it,& delete 'MCBTSSubsystem-' in copy. chomp; my $copy = $_; $copy =~ s/MCBTSSubsystem-//; ## Print the original line and the copy. print "$_ $copy\n"; ## Write to the Output File 'MCBTSSubsystem'. my $line = 'MCBTSSubsystem'; print MCBTSSubsystem $searchline; } } ## Close the O/P File "BSC"; close (BSC) or die $!; ## Close the O/P File "SBSCSubsystem"; close (SBSCSubsystem) or die $!; ## Close the O/P File "MCBTSSubsystem"; close (MCBTSSubsystem) or die $!;