Comma quibbling: Difference between revisions

sed
(sed)
Line 3,271:
{ABC, DEF, G and H}
</pre>
 
=={{header|Sed}}==
script-file:
<lang sed>s/#.*$//g
y/[/{/
y/]/}/
s/"//g
s/ [A-Z][A-Z]*}/ and&/g
s/, and/ and/</lang>
test.txt:
<lang text>[] # (No input words).
["ABC"]
["ABC", "DEF"]
["ABC", "DEF", "G", "H"]</lang>
sed -f script-file test.txt
{{out}}
<pre>{}
{ABC}
{ABC and DEF}
{ABC, DEF, G and H}</pre>
 
=={{header|Seed7}}==
413

edits