Question

I'm trying to retrieve a file (.gz) and read it automatically after finding it, i want to include this in the [action] part of the 'find' command, unfortunately is for some reason not working. What i'm doing is:

find . -name *20120805.gz -zcat

What i get is: find: invalid predicate `-zcat'

Whats wrong with that action? Any advice?

Was it helpful?

Solution

That is really invalid predicate. You must use -exec in this case:

$ find . -name *20120805.gz -exec zcat {} \;

For every file that was found, find runs zcat with the name of the file as an argument.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top