lundi 26 mars 2018

Check if multiple lines exist in text file

Using Perl I would like to check if the two lines highlighted below exist in a text file . Each line is preceded by a tab.

CF=CFU-ALL-PROV-NONE-YES-NO-NONE-YES;
CF=CFB-ALL-PROV-NONE-YES-YES-NONE-YES;
***CF=CFU-TS10-ACT-NONE-YES-NO-NONE-YES;***
CF=CFNRY-ALL-PROV-NONE-YES-YES-NONE-YES;
CF=CFNRC-ALL-PROV-NONE-YES-NO-NONE-YES;
***CF=CFB-TS10-ACT-NONE-YES-NO-NONE-YES;***
CF=CFD-TS10-REG-9124445544-YES-YES;

I am using the following if statement but it is not matched

if (/\t*CF=(CFU-TS10-ACT-(NONE|\d+))/  && /\t*CF=(CFB-TS10-ACT-(NONE|\d+))/)
{       
 say "this case is found here .....";
}

What am I doing wrong ?

Thanks, Graham

Aucun commentaire:

Enregistrer un commentaire