Following the example, a simple approach would be searching for the
'Warnings'
line and then include in your result string all the remaining part.
e.g.
public static string mytrim(string ins)
{
string[] line = ins.Split(new char[] { '\n' });
int n;
for (n=0; n<line.Length; ++n)
{
if (line[n].Contains("-Warnings-"))
break;
}
StringBuilder sb = new StringBuilder();
for (; n < line.Length; ++n)
{
sb.Append(line[n]);
sb.Append("\n");
}
return sb.ToString();
}