UNIX Command to replace particular field

Hello All,
I need your help in getting a command. I have a input file as below:

"A0C0VN","XZ70720","02","MEMBER ELIGIBILITY_DC",2012021308,"",,,20120213

I need a command to remove the field in Bold. To be specific the 5th field along with the next comma (2012021308,) needs to be taken off from the line..

I there any specific command which can achieve this?

Thanks a lot for your support..

Try this:

awk -F, '{for(i=5;i<NF;i++){$i=$(i+1)}NF-=1}1' OFS="," file
sed 's/[^,]*,//5' yourfile
2 Likes

Dear Praveen,
Try the below mentioned command to solve the mentioned one,
CODE:
in sed ::

sed 's/,[0-9][0-9]*,/,/g' File1

[b]in nawk ::

nawk '{gsub(/,[0-9]*,/,",");print ;}' File1

Your i/p is

"A0C0VN","XZ70720","02","MEMBER ELIGIBILITY_DC",2012021308,"",,,20120213

and u will get o/p as

"A0C0VN","XZ70720","02","MEMBER ELIGIBILITY_DC","",,,20120213

[COLOR=purple]Thanks & Regards.
Shanmu

--deleted--

I see.. I was unable to remove it quickly enough :wink:

Lol Scruti :wink: