if you are sure that there are no quotes other than the first and last, just use the /g modifier
$ echo "\"test\"" | sed 's/"//g' test
If you have Ruby (1.9+)
$ echo $s blah"te"st"test $ echo $s | ruby -e 's=gets.split("\"");print "#{s[0]}#{s[1..-2].join("\"")+s[-1]}"' blahte"sttest
Pay attention to the second example of the first and last quotes, which may not be exactly in the first and last positions.
example with a lot of quotes
$ s='bl"ah"te"st"tes"t' $ echo $s | ruby -e 's=gets.split("\"");print "#{s[0]}#{s[1..-2].join("\"")+s[-1]}"' blah"te"st"test
source share