Script to delete a word based on position in a file

Hi,

I am new to unix. I want to delete 2 words placed at position say for example at 23rd and 45th position in a line. I used sed but couldnt achieve this.

Example: the file contains 2 lines

12345 98765 "12345" 876
12345 98765 "64578" 876

I want to delete " placed at position 13 and 19 in both lines.

TIA for your reply

Save file as: filename

sed -r "s/^(.{12})(.{1})/\1/" filename | sed -r "s/^(.{17})(.{1})/\1/"

The first sed:
/^(.{12})(.{1})/ means select 1 ((.{1})) character that comes after the first (^) 12 characters ((.{12}))
/\1/ means keep portion before the selection and replace the selection with nothing. That takes care of the first ".

The second sed simillarly removes the second " (which by the way is not in position 19 anymore, it's character number 18 and hence the option (.{17}))

-G

thanks for your reply. but i am getting illegal option -- r error.

"-r" is not a standard option. It allows one to use extended regular expressions like the one we are using above.

Sorry, I don't know how to do it using basic reg-ex.

You might find some help from here:

-G

thank you.will check that. hope it solves my problem