I have lines as follows in a file
Today is amazing.nice day Today is amazing.nice but still I haven't done anything Yesterday was just a normal day Tomorrow probably will be amazing.new day
What i want to accomplish : I want to be able to go through lines and match "(amazing.*)". If (amazing.*) is unique then put it in an array and also print that line if not ignore it. Basically, this is the result I am looking for.
and so forth....Today is amazing.nice day Tomorrow probably will be amazing.new day
So far I have only written this much code. I just don't know where to go from here. Any direction on how to approach this would be very much appreciated.
#!/usr/bin/perl -w use strict; while ( my $line = <> ) { if ( $line =~ m/(\(amazing.+?\))/) { my $string="$1"; @allstrings = ($string); } }
In reply to How to ignore lines that match certain string after it is matched for the first time within a same file by Ben328
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |