Within a makefile I run the following command
find SOURCE_DIR -name '*.gz' | xargs -P4 -L1 bash -c 'zcat $$1 | grep -F -f <(zcat patternfile.csv.gz) | gzip > TARGET_DIR/$${1##*/}' -
patternfile.csv.gz
contains 2M entries with an unzipped file size of 100MB, each file in SOURCE_DIR
has a zipped file size of ~20MB.
However, each xargs
process consumes more than 6GB of RAM. Does this make sense or do I miss something here?
Thanks for your help.