Mercurial > repos > richard-burhans > ncbi_egapx
view funny.bash @ 41:d129c3d0e920 draft default tip
planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/ncbi_egapx commit 8278322cb9db499c593669d2bb8b740024ecf5dc
| author | richard-burhans |
|---|---|
| date | Mon, 28 Jul 2025 14:35:28 +0000 |
| parents | |
| children |
line wrap: on
line source
#!/usr/bin/env bash taskset -p $$ | sed -e 's/^.*: //' | awk ' BEGIN { split("0 1 2 3 4 5 6 7 8 9 a b c d e f", hex_chars, " ") split("0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4", vals, " ") for (i in hex_chars) { ones[hex_chars[i]] = int(vals[i]) } total = 0 } { split($0, chars, "") for (i in chars) { if (chars[i] in ones) { total += ones[chars[i]] } } print total } ' # 0 0000 0 # 1 0001 1 # 2 0010 1 # 3 0011 2 # 4 0100 1 # 5 0101 2 # 6 0110 2 # 7 0111 3 # 8 1000 1 # 9 1001 2 # a 1010 2 # b 1011 3 # c 1100 2 # d 1101 3 # e 1110 3 # f 1111 4
