I am trying to remove the error messages printed into my file. I have this:
addr:1122c:1234: addr:11230:5678: addr:11223:01Error:abcdef(x, y) = z, value = a Error:hijklm(v, q) = w, value = b Error:nopqrst(x, y) = z, value = d Error:uvwxyz(l, m) = z, value = e Error:1234(u, t) = z, value = f Error:567(r, s) = z, value = g err_total = 9846, err_sub = 0, err_mask = 239 1 Duration: xyz, abc 0 Duration: pqr, def 23: addr:11238:4567: addr:1123c:8901:
I need to remove all the error messages upto the next addr appears. Required output is:
addr:1122c:1234: addr:11230:5678: addr:11223:0123: addr:11238:4567: addr:1123c:8901:
I have tried:
sed -i "/\bError\b/d" file_name
But this removes the lines starting from Error and did not remove the line where Error string started from the middle.
I am new to regular expressions, an explaination would be really helpful.
I am using
sed -i '/Error/,/addr/d' filename
but this removes the whole line and does not give what I am looking for.