Reputation: 193
The problem is removing , errors in text files. The error is the ',' after M.D
xxx","M.D,","abc","xxx
The desired string is to replace the single , after D with a .
xxx","M.D.","abc","xxx
There are over 30 fields in the line
Upvotes: 0
Views: 116
Reputation: 6692
As an alternate solution try this sed command as follows;
sed 's/M.D,/M.D./g' filename
Output:
$ sed 's/M.D,/M.D./g' sample
xxx","M.D.","abc","xxx
Upvotes: 1
Reputation: 67467
I don't know all your cases but for inits this may work
$ echo 'xxx","M.D,","abc","xxx' | sed -r 's/([A-Z]),/\1./'
xxx","M.D.","abc","xxx
Upvotes: 1