Hi
I am reading each line of an input file (IN) and printing the line read to an output file (OUT) if the line begins with one of the patterns, say "ab", "cd","ef","gh","ij" etc. The line printed is of form "pattern: 100" or form "pattern: 100:200". I need to replace "pattern" with "myPattern", i.e. print the current line to FILE but replace all the text before the first occurence of ":" with "myPattern". What is the best way to do this?
Currently I have:
while ( <IN> )
{
print FILE if /^ab:|^bc:|^ef:|^gh:/;
}
I am not sure if substr replacement would help as "pattern" can be either "ab" or"cd" or "ef" or "gh" etc.
Thanks! Bi