You could do:
sed 's/\(\.[^"[:blank:]]*\)[[:blank:]]*"/\1"/g'
That is remove the sequences of blanks that follow . followed by a sequence of non-blank-nor-" characters and are followed by a "
To remove the blanks before every other double quote character on each line, you could do something like:
sed 's/[[:blank:]]*"/"&/g s/\(\([^"]*"\)\{3\}\)[[:blank:]]*"/\1"/g s/"\([^"]*"\)/\1/g'
That is:
- Insert an extra
" before each <blanks>" - Change all the
<X>"<blanks>"<Y>"<blanks>" to <X>"<blanks>"<Y>"" - Remove every other
" to undo the insertions in 1
Or in a more straightforward manner with awk:
awk -F \" -v OFS=\" ' { for (i = 2; i <= NF; i += 2 ) sub(/[[:blank:]]*$/, "", $i) print }'
Note that tr wouldn't squeeze characters unless you use the -s option. More likely you forgot to quote a parameter expansion or command substitution that contained the output of tr.
In any case, tr can't be used for that task. It's just a transliteration tool. All it could do is translate/delete/squeeze all space characters. It cannot translate/delete/squeeze only some space characters.
"character?