script to delete all /n number of lines starting from a word except last line
- by akvikram
how to delete all lines below a word except last line in a file. suppose i have a file which contains
| 02/04/2010 07:24:20 | 20-24 | 26 | 13 | 2.60 |
| 02/04/2010 07:24:25 | 25-29 | 6 | 3 | 0.60 |
+---------------------+-------+------------+----------+-------------+
02-04-2010-07:24 --- ER GW 03
+---------------------+-------+------------+----------+-------------+
| date | sec | BOTH_MO_MT | MO_or_MT | TPS_PER_SEC |
+---------------------+-------+------------+----------+-------------+
| 02/04/2010 07:00:00 | 00-04 | 28 | 14 | 2.80 |
| 02/04/2010 07:00:05 | 05-09 | 27 | 14 | 2.70 |
...
...
...
...
END OF TPS PER 5 REPORT
and i need to delete all contents from "02-04-2010-07:24 --- ER GW 03" except "END OF TPS PER 5 REPORT" and save the file.
This has to be done for around 700 files. all files are same format, with datemonthday filename.