I need to remove double quoted strings from specific lines in a file. The specific line numbers are a variable. For example, line 5 of the file contains
A B C "string"
I want to remove "string". The following sed command works:
sed '5 s/\"[a-zA-Z0-9]*\"//' $file
If there are multiple lines in the file that need to edited and the line number is a variable, i.e. $lineno, the following does not work:
sed '$lineno s/\"[a-zA-Z0-9]*\"//' $file
I believe the sed command must be double quoted for the variable to be evaluated, so I tried that and I get the error - Unmatched ".
sed "$lineno s/\"[a-zA-Z0-9]*\"//" $file