-v and -f option for grep not working

In solaris, i m trying to find the files having a particulat extension and then from the list i want to exclude those files which is present in a file.

But it seems the -f and -v option are not working

 
find $source -type f -name $extn | /usr/xpg4/bin/grep -F -v -f $exclude | while read filename
 
do 
 
echo $filename
 
done

In solaris, i m trying to find the files having a particulat extension and then from the list i want to exclude those files which is present in a file.

But it seems the -f and -v option are not working

 
find $source -type f -name $extn | /usr/xpg4/bin/grep -F -v -f $exclude | while read filename 
do 
echo $filename
 done

How could anyone guess what files are under $source, what the $extn variable contains and what the $exclude file contains ?

Please provide more details about what makes you feeling these options do not work.

$source="/usr/var/SA"
$extn="*.pll"
$exclude="a.txt"
$exclude is the file name which contains name of the file those will be excluded.

Please provide some evidence the options do not work.

Since you don't show us how source, extn, and exclude are set and you haven't shown us the contents of the file named by the expansion of $exclude, this is just a guess. But I think it is highly likely that your problem is the find command; not the grep command.

I'm guessing that if you're looking for files with the extension ".c" you have set extn to ".c" and your find isn't finding any files named ".c". Try changing the find statement to:

find $source -type f -name "*$extn"

If that doesn't fix your problem, you're going to have to supply a lot more detail about what all of these variables contain, what files exist in the file hierarchy rooted at $source, and what is in the file named by $exclude.

Two threads merged. Sorry for the confusion.

Some important details are missing:

What is the output? Are there any diagnostic messages (like "file not found", etc.)?

The variables you use should all be quoted by double quotes. Blanks in the file names might break your command, for instance.

Is the file "$exclude" indeed found? It might be referenced by a relative path name which works from one PWD but not another.

What is the content of "$extn"? To work it would need to include a wildcard (like "*ext") and this would definitely have to be quoted, otherwise the shell (and not "find") would expand it.

I hope this helps.

bakunin