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

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -