Changing characters
 Changing a set of characters to another set of characters is generally a task for the tr command but since you want to do it only on certain lines only, it will be best done by sed indeedwhich has a y command similar to tr:
sed -e "/^KEYWORD_1/ s y/\"/'/g"" \
    -e "/^KEYWORD_2/ s y/'/\"/g"" \
    file
 Each sed command here starts with a line selector /KEYWORD^KEYWORD/ which instructs sed to only operate on the line matching the pattern between /. Here the patterns start with the character ^ to indicate it isthey are to be found at the beginning of the line.
 Following the line selector is sed's substitution command sy/xxxset1/yyyset2/g which replaces every occurrence of patterna character in xxxset1 with stringthe character which has the same position in yyyset2.
Swapping characters
 Now, if on the same line you want to replace each " with ' and at the same time each ' with ", you mustcan use the y sedonly one command instead of s:
sed -e "/^KEYWORD_1\|^KEYWORD_2/  y/\"'/'\"/" file