relpipe-data/examples/parallel-hashes-1.sh
author František Kučera <franta-hg@frantovo.cz>
Tue, 04 Aug 2020 00:59:32 +0200
branchv_0
changeset 313 a43265235e5a
parent 294 abbc9bcfbcc4
permissions -rwxr-xr-x
examples: Monitoring MIDI messages using JACK – relpipe-in-jack: @id for the MT-32 part

#!/bin/bash

findFiles() {
	find /bin/ -print0;
}

fetchAttributes() {
	relpipe-in-filesystem \
		--parallel 4 \
		--file path \
		--file type \
		--file size \
		--streamlet hash;
}

aggregate() {
	relpipe-tr-sql \
		--relation "file_hashes" \
		"SELECT
			path,
			type,
			size,
			sha256,
			count(*) OVER (PARTITION BY sha256) AS same_hash_count
		FROM filesystem
		ORDER BY same_hash_count, sha256, path, type";
}

findFiles | fetchAttributes | aggregate | relpipe-out-tabular