Hallo again...
I 2 previous threads I have successfully manages to rewrite an email body. I have a small problem though. The email is passed to an application that does not allow certain charactes, let's use the '&' as an examle.
I have this:
# Set field-separator.
BEGIN { FS = " *= *" }
# Remove trailing spaces.
{ sub(/[ \t]+$/, "") }
!working && /^$/ { working = 1
print "\n\n<TAG1>
!working { print ; next }
/^phone_number/ { pr(); $0 = "<phone>"$2"</phone>"
print; next}
/^textfield2/ { pr(); accum="<problem_desc>" $2; next}
NF { accum = accum RS $0 }
END { pr(); print "</TAG1>\n" }
function pr()
{ if ( accum ) print accum "</problem_desc>"
accum = ""
}
1
The textfield2 however may contain the & character. Is there a way to search and replace this character (if it is there) with for example the word 'and' ?
I 2 previous threads I have successfully manages to rewrite an email body. I have a small problem though. The email is passed to an application that does not allow certain charactes, let's use the '&' as an examle.
I have this:
# Set field-separator.
BEGIN { FS = " *= *" }
# Remove trailing spaces.
{ sub(/[ \t]+$/, "") }
!working && /^$/ { working = 1
print "\n\n<TAG1>
!working { print ; next }
/^phone_number/ { pr(); $0 = "<phone>"$2"</phone>"
print; next}
/^textfield2/ { pr(); accum="<problem_desc>" $2; next}
NF { accum = accum RS $0 }
END { pr(); print "</TAG1>\n" }
function pr()
{ if ( accum ) print accum "</problem_desc>"
accum = ""
}
1
The textfield2 however may contain the & character. Is there a way to search and replace this character (if it is there) with for example the word 'and' ?