Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
全部。
我是sed的新手。
我想要类似的东西
输入:
ABC,DEF,GHI,JKL,MNO
输出:
ABC,,,,MNO
方法....
I want to remove all contents between two ','
这可能对您有用(GNU sed):
sed 's/[^,]*,/,/2g' file
you could set all fields between 1 and last to empty with awk:
awk -F, -v OFS="," '{for(i=2;i<NF;i++)$i=""}7'