The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 09-22-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,748
What you are asking is to create a resultset that all files minus pattern1 minus pattern2

The only problem for this is that we will have to use grep -v. The file matching patterns become regular expressions
Code:
??????.xls
# becomes regex:
[0-9]{6}\.xls
This will happen for every file you want to exclude. Otherwise, you cannot just
Code:
ls !(pattern)
for five different files because each instance of !(pattern2) will show other patterns like pattern2 pattern3... etc.
Code:
# generalized solution
ls directory | grep -v -e 'regex1' -e 'regex2' -e 'regex3'
Therefore you have to construct 50 different regexes (one for each file you have to specify) and apply some of them to the correct directory output from ls. I cannot do that for you.