mardi 6 septembre 2022

How to remove all lines from file after match pattern via sed?

My file looks like this:

REMARK min ENERGY 1.77175E+03

ATOM 1 CA LYS A 1 -21.142 -8.789 54.528 0.000

ATOM 2 CB LYS A 1 -21.241 -5.717 54.554 0.000

ATOM 3 CA ASP A 2 -18.188 -10.767 55.880 0.000

ATOM 4 CB ASP A 2 -16.711 -12.091 55.446 0.000

ATOM 5 CA CYS A 3 -16.736 -10.833 59.388 0.000

ATOM 6 CB CYS A 3 -16.914 -12.168 59.755 0.000

ATOM 7 CA ASP A 4 -13.188 -11.313 60.698 0.000

ATOM 8 CB ASP A 4 -13.676 -10.118 62.262 0.000

ATOM 9 CA CYS A 5 -11.145 -14.466 61.345 0.000

ATOM 10 CB CYS A 5 -10.364 -14.376 60.189 0.000

ATOM 11 CA ASN A 6 -8.413 -14.441 63.984 0.000

ATOM 12 CB ASN A 6 -9.133 -15.644 65.420 0.000

TER

ATOM 13 CA ASP B 1 2.533 24.661 19.681 0.000

ATOM 14 CB ASP B 1 4.137 24.133 20.797 0.000

ATOM 15 CA SER B 2 -0.294 22.270 19.000 0.000

ATOM 16 CB SER B 2 -0.987 23.147 19.688 0.000

ATOM 17 CA GLU B 3 -2.199 23.018 15.823 0.000

etc.

I want remove all lines from my file.txt after "TER" via sed command in bash. Can you help me, because I'm totally beginner in writing bash script.

Aucun commentaire:

Enregistrer un commentaire