Q:

insert string between each pair of doublequotes

I am stuck with situation, I have string as shown below:
-name "B_12*" -o -name "B_21*" -o -name "B_31" -o -name "B_41"

My requirement is I want to convert above string is as shown below:
-name "B_12*.tar" -o -name "B_21*.tar" -o -name "B_31.tar" -o -name "B_41.tar"

I am not expert with bash commands but I have little bit idea the problem could be solved with sed command.

A:

The only tricky part here is that you need to match both quotes so that they won't be matched again. With a sed distro which has ERE support by -E option, following command would suffice.
sed -E 's/("[^"]*)"/\1.tar"/g' file

