Bash script pass find files to awk [Mac] -


i have gzipped log files in directory , this:

log/day_1_time_log_1.log.gz ... log/day_1_time_log_100.log.gz log/day_1_location_log_1.log.gz ... log/day_1_location_log_100.log.gz 

i take 4th column (some json strings) logs containing string time , cat them 1 file. did , getting zcat: unknown compression format error.

find logs/* -name *time* | zcat | awk -f"\t" '{ print $4 }' > output.json 

what wrong code? can pass directly awk?

you can use xargs:

find logs/ -name '*time*.log.gz' -print0 |      xargs -0 -i % gzcat % | awk -f'\t' '{print $4}' > output.json 

Comments

Popular posts from this blog

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -