Home > database >  Find command. How to process founded files to gunzip and then to grep by pattern
Find command. How to process founded files to gunzip and then to grep by pattern

Time:10-28

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.

CodePudding user response:

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
  • Related