Pattern Search with grep

Hello,

I have a bunch of zip files like

 
SS_SAMPLE_101_123.zip
SS_101_123.zip
SS_SAMPLE_121_345.zip
SS_SAMPLE_222_678.zip
SS_123_890.zip
SS_.zip

The 'ls' should search and list the files such as SS_101_123.zip and SS_123_890.zip alone. Could you please guide me with this. :rolleyes:. I would like to return records with the name pattern

 
SS_<number>_<number>.zip

I do not fully understand what you are trying to achieve but a simple solution is just

ls "SS_101_123.zip" "SS_123_890.zip"

Do you want to search only those two files or all files which terminate with _101_123.zip etc?

Hello, Thanks for the reply, I would like to list all the records with the pattern SS_<number>_<number>.zip :confused:

How about

 ls SS_[0-9]*.zip

You may need to refine the pattern.

1 Like
SS_[0-9]*_[0-9]*.zip
1 Like

Thank You very much.:o