Friday, May 26, 2017

Unix: Find list of files in gz format contain strings

$ find . -name "*.gz" -exec zgrep -la bbarney03@xxxx.com \{\} \;
./aaa_1/231_20160606193002_232895_330_20160606_231655_1_0000_01.act.gz
./aaa_1/231_20160606173001_604598_330_20160606_211628_1_0000_01.act.gz
./aaa_1/232_20160606191508_769207_935_20160606_230502_1_0000.act.gz
./aaa_1/232_20160606191600_522897_329_20160606_230518_1_0000.act.gz
./aaa_1/232_20160606160002_239869_935_20160606_194946_1_0000.act.gz
./aaa_1/232_20160606094601_736357_329_20160606_133804_1_0000.act.gz
./aaa_1/232_20160606103002_77028_935_20160606_141917_1_0000.act.gz
./aaa_1/231_20160606113107_109722_840_20160606_152107_1_0000.act.gz
./aaa_1/231_20160606120002_183644_330_20160606_154014_1_0000_03.act.gz
./aaa_1/231_20160606094501_813187_330_20160606_133446_1_0000_00.act.gz
./aaa_1/232_20160606114501_577769_935_20160606_153424_1_0000.act.gz
./aaa_1/232_20160606104600_643312_329_20160606_143819_1_0000.act.gz
./aaa_1/232_20160606103107_699907_837_20160606_141919_1_0000.act.gz
./aaa_1/231_20160606120019_863535_330_20160606_154515_1_0000_01.act.gz
./aaa_1/232_20160606094701_251538_329_20160606_133804_1_0000_03.act.gz
./aaa_1/232_20160606153002_294217_935_20160606_191943_1_0000.act.gz
./aaa_1/232_20160606160107_988588_837_20160606_194949_1_0000.act.gz
./aaa_1/232_20160606160102_442949_329_20160606_195433_1_0000.act.gz
./aaa_1/232_20160606114603_483834_837_20160606_153426_1_0000.act.gz
./aaa_1/231_20160606153002_218144_330_20160606_191602_1_0000_02.act.gz

$ zgrep -i bbarney03@xxxx.com 231_20160609122102_492219_840_20160609_160748_1_0000.act.gz

$ zgrep -la bbarney03@sxxxxcom 231_20160609122102_492219_840_20160609_160748_1_0000.act.gz

find . -name "*.gz" -exec zgrep -la 8434763502 \{\} \;
find . -name "*.gz" -exec zgrep -la 50495939382 \{\} \;