I am currently trying to find out if I can "chomp" (or another command) multiple lines once I find what ever im searching for... I'm currently opening a ascii text file sending it to an array... Then while in a for loop i am reading each element of the array...
for($i=0;$i<@txtfile;$i++) {
what I have run into is that inside of the text file that I'm reading, i have many lines that have the same data...
Currently i'm using the chomp command to find and set the variables i need...
##### Get Keyword Variable #####
if ($txtfile[$i] =~ /\bKeyword:/) {
chomp ($keyword = $txtfile[$i]);
$keyword =~ s/Keyword: //;
#print "$keyword\n";
}
is there a way to chomp / capture multiple lines while i'm already in the for loop incrementing each line...
so as example i would like to capture the following data from example below... (each "Include:" seperatley)
text file excerpt:
Client/HW/OS/Pri: natsciexevs19 PC WindowsNET 0 0 0 0 ?
Include: Microsoft Information Store:\SG1
Include: NEW_STREAM
Include: Microsoft Information Store:\SG2
Include: NEW_STREAM
Include: Microsoft Information Store:\SG3
Exclude: (none defined)
I would like to capture each of the "Include:" lines and set them to $include1 , $include2 , $include3 etc... the problem i continue to run into is that I over write my variable with the second instance of "Include"...
|