Saturday, October 29, 2022

[SOLVED] Find command. How to process founded files to gunzip and then to grep by pattern

Issue

Example:

find . -name 'audit_log*.gz' -print -exec gunzip -c {} \| grep IP  \;

Need to add a key to this to get: -file name. -list IP from audit_log*.gz files.


Solution

You've used the semi-column incorrectly. It should be at the end of the find command and before the pipe. Try this one-liner:

find . -type f -iname 'audit_log*.gz' -exec gunzip -c {} \; | grep IP


Answered By - MobleyX86
Answer Checked By - Robin (WPSolving Admin)