0

不是一个真正的具体问题,因为我知道的不够多——更多的是关于如何解决这个问题的问题。

示例文件如下所示:

 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 TO 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: all 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: all 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 at equilibrium (negative if equilibrium is on port).              
 GM    : GM at equilibrium.                                                     
 FBmin : Minimum distance of margin line, weathertight or non-weathertight      
         points from waterline.                                                 
 GZ>0  : Range of positive GZ limited to immersion of non-weathertight openings.
 GZmax : Maximum GZ value.                                                      

它是其中之一,它们可能会有所不同,但它们都可以归结为文本形式的表格。在将它们粘贴到报告中之前,我需要清理其中的一些项目。

所以我想知道 - 删除某个表的文本方式是什么。例如,SUMMARY OF LOADING(它从包含“SUMMARY OF LOADING”的行开始,到包含“TOTAL WEIGHT”的行结束)。

如何匹配该表并删除它?

4

2 回答 2

4

在 vim 中尝试以下操作

:g/SUMMARY OF LOADING/, /TOTAL WEIGHT/d

sed 的工作方式相同:

sed '/SUMMARY OF LOADING/, /TOTAL WEIGHT/d' input_with_tables.txt
于 2013-04-18T16:36:06.177 回答
0

:g如果您需要删除所有此类表,Fredrik Pihl 的解决方案效果很好。对于更具体的编辑,您可以使用我的CountJump 插件通过定义开始和结束模式(如SUMMARY OF LOADINGTOTAL WEIGHT在您的情况下)来创建自定义动作和文本对象,然后快速跳转到下一个表并使用快速映射删除一个表。

于 2013-04-19T06:25:40.350 回答