我想根据列值添加来自多行的各个条目。 例如输入:基于列合并行linux
column 4 column 5 column 7
abc PD 8
xyz PD 1
abc PD 2
xyz PD 7
xyz PD 3
预期输出:
column 4 column 5 column 7
abc PD 10
xyz PD 11
我尝试使用SQUEUE命令作为我使用找工作的用户information.subsetting为一个特定的列,其中PD是标准之一。
squeue | tr -s ' ' | awk '($4 == "PD")' | cut -d ' ' -f4,5,7 | awk '{a[$4]+=$7}END{for (i in a) print i,a[i]}'
我得到0作为答案。
后的实际样品,你当前输入不包含'PD'串 – RomanPerekhrest
我编辑的问题。希望现在有意义。 –
在列标题列“列5”中是否真的有空格? – RomanPerekhrest