regex - Deleting tables with regular expressions -
not specific question, since don't know enough - more of question on how approach this.
example file can seen below:
loading condition : 4-homogenous cargo 98% 1.018t/m3, draught 3.35m - outgoing items of loading ------------------------------------------------------------------------------- capa item reference x1 x2 weight kg lcg yg fsm no (m) (m) (t) (m) (m) (m) (t.m) ------------------------------------------------------------------------------- 13 no2 cargo tk p 1.650 29.400 609.04 2.745 15.525 -3.384 483.49 14 no2 cargo tk s 1.650 29.400 603.61 2.745 15.525 3.384 483.49 15 no1 cargo tk p 29.400 56.400 587.23 2.745 42.900 -3.384 470.42 16 no1 cargo tk s 29.400 56.400 592.45 2.745 42.900 3.384 470.42 17 mgo tank aft 21.150 23.400 23.42 6.531 22.275 -0.500 15.70 18 storage tank 21.150 23.400 2.68 7.225 22.275 2.300 0.00 19 mgo fore tank 33.150 35.400 25.90 6.643 34.275 -0.212 0.00 ------------------------------------------------------------------------------- deadweight 2444.34 2.828 29.007 -0.005 1923.52 summary of loading weight kg lcg yg fsm (t) (m) (m) (m) (t.m) ------------------------------------------------------------------------------- deadweight 2444.34 2.828 29.007 -0.005 1923.52 light ship 634.00 3.030 28.654 0.000 0.00 ------------------------------------------------------------------------------- total weight 3078.34 2.869 28.935 -0.004 1923.52 loading condition : 4-homogenous cargo 98% 1.018t/m3, draught 3.35m - outgoing damage case : 1bott: cargo & void3 flooding percentage : 100 % flooded volumes : no.3 void space p no.3 void space s no2 cargo tk p no2 cargo tk s no1 cargo tk p no1 cargo tk s ------------------------------------------------------------------------------- weight kg lcg yg fsm corr.kg (t) (m) (m) (m) (t.m) (m) ------------------------------------------------------------------------------- total weight 3078.34 2.869 28.935 -0.004 1923.52 3.494 run-off weights 0.00 0.000 0.000 0.000 0.00 0.000 ------------------------------------------------------------------------------- damage condition 3078.34 2.869 28.935 -0.004 1923.52 3.494 equilibrium not found on starboard loading case : 4-homogenous cargo 98% 1.018t/m3, draught 3.35m - outgoing ------------------------------------------------------------------------------- weight kg lcg yg fsm corr.kg (t) (m) (m) (m) (t.m) (m) ------------------------------------------------------------------------------- total weight 3078.34 2.869 28.935 -0.004 1923.52 3.494 summary of results of damage stability ------------------------------------------------------------------------------- damage case % r heel gm fbmin gz>0 gzmax area (deg) (m) (m) (deg) (m) (m.rad) ------------------------------------------------------------------------------- 1bott: cargo & void3 100 0 equilibrium not found % : flooding percentage. r : r=1 if run-off weights considered, r=0 if no run-off. heel : heel @ equilibrium (negative if equilibrium on port). gm : gm @ equilibrium. fbmin : minimum distance of margin line, weathertight or non-weathertight points waterline. gz>0 : range of positive gz limited immersion of non-weathertight openings. gzmax : maximum gz value.
it 1 of many, can differ bit, come down tables in textual form. need clean items them, before pasting them in report.
so wondering - text way delete table. example, summary of loading (it starts line containing "summary of loading" , end in line containing "total weight").
how match table , delete it?
try following within vim
:g/summary of loading/, /total weight/d
sed works in same way:
sed '/summary of loading/, /total weight/d' input_with_tables.txt
Comments
Post a Comment