Identify file name pattern in different file names

Hi,

need help in recognizing the pattern of file name. For e.g.

 
file name 1: <static file prefix>.<store cd>_<YYYYMMDD>.<ext>
file name 2: <static file prefix>_<YYYYMMDD>.<ext>

I want to know that there are 3 dots "." in the file name1 and one dot "." in file name2. How can I know this?

-dips

There are only two dots in file name 1. Please re-confirm.

oh yeah sorry!! two dots in file name1.......

-dips

[ $(echo "<static file prefix>.<store cd>_<YYYYMMDD>.<ext>" | grep -o '\.' | wc -l) -eq 2 ] && echo "file1 has 2 dots"
1 Like