comparison 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
comparison
equal deleted inserted replaced
40:b095c69eab5b 41:d129c3d0e920
1 #!/usr/bin/env bash
2
3 taskset -p $$ | sed -e 's/^.*: //' | awk '
4 BEGIN {
5 split("0 1 2 3 4 5 6 7 8 9 a b c d e f", hex_chars, " ")
6 split("0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4", vals, " ")
7 for (i in hex_chars) {
8 ones[hex_chars[i]] = int(vals[i])
9 }
10 total = 0
11 }
12
13 {
14 split($0, chars, "")
15 for (i in chars) {
16 if (chars[i] in ones) {
17 total += ones[chars[i]]
18 }
19 }
20 print total
21 }
22 '
23
24
25 # 0 0000 0
26 # 1 0001 1
27 # 2 0010 1
28 # 3 0011 2
29 # 4 0100 1
30 # 5 0101 2
31 # 6 0110 2
32 # 7 0111 3
33 # 8 1000 1
34 # 9 1001 2
35 # a 1010 2
36 # b 1011 3
37 # c 1100 2
38 # d 1101 3
39 # e 1110 3
40 # f 1111 4
41