I want to merge two unzipped files f1
and f2
in one command, like
paste (zcat f1.gz) (zcat f2.gz).
What is the right syntax?
I want to merge two unzipped files f1
and f2
in one command, like
paste (zcat f1.gz) (zcat f2.gz).
What is the right syntax?
Great answer: Thanks a lot.
I've used it for pasting three columns, each one in a compressed file.
Just for sharing : source 3200 redhat machines, 250 millions of points aprox per day...
This is not exactly the way we get all the files locally but catch the idea ( we use ansible
in the real task)
for i in $(cat list_of_hostnames.txt)
do
sadf -U -- -A <file from yesterday> | pigz -9 > host_date_file.tsv.gz
done
Asume we get all such files in the working directory:
pigz -cd *.tsv.gz| sed -E 's/\t/\n/g' | split --numeric-suffixes=1 -nr/6 - kk.
After such command, you get six compressed files called kk.01
to kk.06
corresponding to hostmane, interval, timestamp in seconds from epoch, device, metric and value.
Just for saving space :
rm kk.02
( I don't need interval having timestamps) and then
pigz -9 kk.0[13456]
and now is when I use :
paste <(zcat kk.05.gz ) <(zcat kk.01.gz) <(zcat kk.04.gz) <(zcat kk.06.gz) | grep '%idle' | pigz -9 > metric_host_device_value.tsv.gz
paste
, or otherwise? – dhag Apr 14 '15 at 14:12