Originally Posted by colucix
Well. Grep searches a given pattern in the file content, not a file inside a directory. You can try to use the command test as in my first example above. Furthermore, what do you mean for "to count the number of times filename.log appears in a particular directory"? The file is unique: it exists or not. Eventually you can look if one or more files whos names begin with a particular string exist and how many they are. Or maybe I have still misunderstood your post, sorry.
Well, it will be part of an IF statement in a script. Something like...
num = count number of times filename.log appears in directory
num > 0
copy file to new location for analysis
if the file does not exist, the script errors, so the if statment is necessary.
there may be another way to check if a file exists... I figured this would be the easiest (if grep can even do this). Sorry, I'm still new to this.
I will give TEST a shot.