user3388884 user3388884 - 11 days ago 7
Linux Question

How to use sed to remove all lines until first match in first column?

How to use sed to remove all lines until first match in first column? The result should keep the last three lines.

file

1fff
2ddd
3zzz

TestXXX
TestXXX
Test XXX
Mike
Charly


sed -i '/Test/' file

Answer
sed -n '/^Test/,$p' oldfile > newfile