Code:
sed -e '/^"TEST/{p;N;s/.*\n[0-9]*/0/;}' filename
There are many different versions of
sed, so yours might not understand exactly the same dialect as mine.
This looks for '"TEST' (with an opening double quote) at beginning of line. If found, it prints that line (
p), and appends the next line to the pattern space (
N). This causes the pattern space to contain two lines; the TEST line and the following line, separated by a newline. Then it replaces (
s///) the first line in the pattern space, the newline, and any numbers just after the newline with a zero. At that point, we are done; whatever is left in the pattern space will be printed as usual.
sed syntax is very terse; if you don't have a specific reason to use
sed for this, perhaps an equivalent
awk or Perl script would be more maintainable (especially if you are not very familiar with
sed).