I want to transform this text (remove ) with sed, awk or perl:
{|
|-
| colspan=\"2\"|
:
This isn't quite the one-liner but it does what you're looking for. As always there are many ways of doing this. But here I am using '|' as the records separator and ':' as the field separator. That allows me to iterate over the fields in a record that contains math and only print the fields that don't contain .
BEGIN {RS="|";FS=":";ORS=""}
/math/ {
for (i=1;i<=NF;i++) {
if ($i ~ /math/) {print ":\n"}
else {print $i}
}
print "|";next;
}
/^\}/ {
print "}";
next;
}
{
print $0"|"
}
END {print "\n"}