是否有人知道awk或linux命令基于头中的部分模式匹配删除.csv文件列?我尝试了很多例子,但它要么什么也没做,要么删除了所有的列。
Example: I want the columns removed that have the header name "(RAW)" within it.
G_TP01_OPER_ID,G_TP01_OPER_ID(RAW),G_TP02_PROC_NO,G_TP02_PROC_NO(RAW)
4008636142,4008636142,4008636142,4008636142,4008636142
Desired output:
G_TP01_OPER_ID,G_TP02_PROC_NO
4008636142,4008636142
谢谢您!
最佳答案
awk -F, '{print $1,$3}' OFS="," file
G_TP01_OPER_ID,G_TP02_PROC_NO
4008636142,4008636142