如何 gnu 并行计算出现在 CSV 文件列中的非数字的脚本

How to gnu parallel this script that counts non-numerics appearing in CSV file columns

我使以下脚本并行的尝试失败了。这里有什么诀窍?此脚本一次处理文件的一列。我想并行处理许多列。

这是顺序脚本。它 returns 值 1 正确,因为这是 CSV 文件第 11 列中有多少非数字:

$ tail -n +2 beerdirty.csv | cut -d, -f 11 | awk -F"," '((+0 != ) && (!="")){cnt++} END{print cnt+0}'
1

这是我在 gnu parallel 上失败的尝试。我只希望 seq 中的整数进入 cut -f 参数。可能引号字符有问题:

$ seq 1 12 | parallel 'tail -n +2 beerdirty.csv | cut -d, -f {} | awk -F"," "((+0 != ) && (!="")){cnt++} END{print cnt+0}"'
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )
awk: line 1: syntax error at or near )

谢谢

未测试:

doit() {
  tail -n +2 beerdirty.csv |
  cut -d, -f  |
  awk -F"," '((+0 != ) && (!="")){cnt++} END{print cnt+0}'
}
export -f doit
seq 1 12 | parallel doit