Text to be processed :
""text""
"text"
""
output desired :
"text"
"text"
""
Tried with :
echo -e '""text""\n"text"\n""' | sed -e 's/"".*""/".*"/g'
But obviously no luck.
Cheers,
Text to be processed :
""text""
"text"
""
output desired :
"text"
"text"
""
Tried with :
echo -e '""text""\n"text"\n""' | sed -e 's/"".*""/".*"/g'
But obviously no luck.
Cheers,
Another approach
Details
sed 's/"//g'
remove all double quotesed 's/^/"/g'
put a double quote at the beginning of each linesed 's/$/"/g'
put a double quote at the end of each lineNote
This approach will work only if there is one word per line, like in your example.
Based on your sample input, you could just use this:
On lines which don't only contain two double quotes, globally replace all pairs of double quotes with one double quote.
Could you please try following awk command and let me know if this helps you.
Answer by Aaron is also fine but back-referencing is costlier in general. Why not use a simpler command:
Regex to replace more than one double quote to single one.