Redirecting part of output to stdout

Hi,

I am trying to execute a command like this:

find ./ -name "*.gz" -exec sh -c 'zcat {} | awk -f parse.awk' \; >> output

If I want to print the filename, i generally use the -print argument to the find command but when I am redirecting the output to a file, how can I print just the filenames into stdout with the rest of the output into the file? Any help is much appreciated.

EDIT: Ah... Figured out... Sorry... Here's the solution:

find ./ -name "*.gz" -exec sh -c 'zcat {} | awk -f parse.awk >> output' \;

The solution was to put the redirection inside the exec itself...

Well done! :slight_smile:

Thank You :slight_smile: Just learning Unix so got curious in messing around with things...