background: my target is to filter the files that contain the word - old
I want to print all files expect the files that contain the old word (capital or small letters ) ,
according to the following rules:
if Az-zZ is before the old name or after the old name then line should be printed
if Az-Zz is after the old name and before old word then line should be printed
if 0-9 is after the old name and before old word then line should be printed
if 0-9 is before the old name and after old is non Az-zZ or 0-9 then line should not printed
if 0-9 is after the old name and before old is non Az-zZ or 0-9 then line should not printed
examples
/DIR3/DATA/A4/Via/OOld/TriR.txt --> should be print
/DIR4/DATA/A4/Via/AOld1/Comne.txt --> should be print
/DIR5/DATA/A4/Via/BOld/TriR.txt --> should be print
/DIR5/DATA/A4/Via/aOld/TriR.txt --> should be print
/DIR5/DATA/A4/Via/1OldA/TriR.txt --> should be print
/DIR5/DATA/A4/Via/POld1/TriR.txt --> should be print
/DIR4/DATA/A4/Via/1Old1/Comne.txt --> should be print
/DIR4/DATA/A4/Via/1Old1/Comne.txt --> should be print
/DIR4/DATA/A4/Via/Comne.txt --> should be print
/DIR1/DATA/A4/Via/5Old/CentalS.txt --> should not be print
/DIR4/DATA/A4/Via/Old1/Comne.txt --> should not be print
/DIR1/DATA/A4/Via/Old/CentalS.txt --> should not be print
/DIR4/DATA/A4/Via/Old11/Comne.txt --> should not be print
/DIR4/DATA/A4/Via/OLD@/Comne.txt --> should not be print
/DIR4/DATA/A4/Via/.OLd/Comne.txt --> should not be print
/DIR4/DATA/A4/Via/home/Comne.Old_txt --> should not be print
/DIR4/DATA/A4/Via/home/Comne.old_txt --> should not be print
/DIR4/DATA/A4/Via/home/Comne.0old_txt --> should not be print
/DIR4/DATA/A4/Via/home/Comne.old6_txt --> should not be print
/DIR4/DATA/A4/Via/home/Comne___0old_txt --> should not be print
Please advice how to implement this by perl one liner line
syntax
echo $PATH | perl one liner line
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…