Skip to content

Instantly share code, notes, and snippets.

@falsycat
Last active January 27, 2023 06:30
Show Gist options
  • Save falsycat/e32e152c9e3117a8d360a5b264e3eebe to your computer and use it in GitHub Desktop.
Save falsycat/e32e152c9e3117a8d360a5b264e3eebe to your computer and use it in GitHub Desktop.
#!/bin/bash
rec=$(cat -)
n=$(awk '$0!=""{++a}END{print a}' <<< "$rec")
sort -g -k $1 <<< "$rec" | awk -v "i=$1" -v "n=$n" '$0!=""{
++a;
p = $(i)*(n-a+1);
if (p>0.05) exit;
for (x=1;x<=NF;++x) {
if (x == i) {
printf "%f ", p;
} else {
printf "%s ", $(x);
}
}
printf "\n";
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment