我已经将 perfmon 输出到 csv,我需要删除任何重复的列,例如
COL1, Col2, Col3, COL1, Col4, Col5
当列重复时,它几乎总是相同的列,但并非每次都发生。到目前为止,我有几个手动步骤:
当列数大于它应该是我在单行上输出所有列标题:
head -n1 < output.csv|sed 's/,/\n/g'
然后,当我知道哪些列号有罪时,我会手动删除,例如:
cut -d"," --complement -f5,11 < output.csv > output2.csv
如果有人能指出我正确的方向,我将不胜感激!
更新以给出 output.csv 内容的粗略示例,任何使用过 perfmon 的人都应该熟悉:
"COLUMN1","Column2","Column3","COLUMN1","Column4"
"1","1","1","1","1"
"a","b","c","a","d"
"x","dd","ffd","x","ef"
我需要删除重复的 COLUMN1(第 4 列)
为了清楚起见,我正在尝试一种自动进入 output.csv 并删除重复列的方法,而不必告诉它要删除哪些列,就像我上面的手动方法一样。谢谢!