First, the regular warning about not parsing
ls. That said, assuming your files are named sanely, you could do:
ls debs/*1.1.16* | grep -E 'Package1|Package2|package3'
The only difference here is that I'm avoiding the 1st grep, which isn't needed since you can directly pass a glob pattern to
ls. Then, instead of the deprecated
egrep, I'm using
grep -E which is the same thing.
However, this is essentially the same as your command. If it didn't work, then you don't have matching files:
$ ls debs/
1.1.16.Package3 Package188.8.131.52 Package184.108.40.206 Package220.127.116.11
$ ls debs/*1.1.16* | grep -E 'Package1|Package2|package3'
As expected, that shows the two matching files. And this is exactly what your command would have printed as well:
$ ls debs/* | grep 1.1.16 | egrep -e 'Package1|Package2|package3'
Note that since the
package3 is lowercase (
p instead of
P) in the
grep pattern, the file
1.1.16.Package3 is not shown.