for what's worth: a raku solution for stackexchange question

[email protected] (Marc Chantreux)
Newsgroups perl.perl6.users
Message-ID <Zwb_fzIfLcp9yAvy@prometheus>
hello people,

I saw this post

https://unix.stackexchange.com/questions/783990/merge-multiple-files-using-full-join-by-the-first-column/784240#784240

and just had fun writing the following solution but there is no way I'll
create an account on stackexchange. feel free to reuse if you think it's
helpful.

<<% cat > 346_T1_A_deduped.bismark.cov_format
1_10525 95.2
1_10526 98.9690721649485
1_10542 80.8
1_10543 87.6288659793814
%
<<% cat > 346_T1_B_deduped.bismark.cov_format
1_10525 95.7142857142857
1_10526 98.1132075471698
1_10542 78.5714285714286
1_10549 75.4716981132076
%
raku -e '
	say join ",",  @*ARGS;
	my %data = @*ARGS.map: { $_ => %(  .IO.lines.map: | *.words ) };
	for keys set %data.values».keys -> \k {
		say join ",", k, @*ARGS.map: { %data{$_}{k} // "N/A" }
	}
' *mat

346_T1_A_deduped.bismark.cov_format,346_T1_B_deduped.bismark.cov_format
1_10526,98.9690721649485,98.1132075471698
1_10543,87.6288659793814,N/A
1_10525,95.2,95.7142857142857
1_10542,80.8,78.5714285714286
1_10549,N/A,75.4716981132076

HTH, regards

-- 
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.