根据模式删除多行

时间:2017-02-27 07:56:34

标签: bash awk sed grep

我想根据开始和结束模式删除多行。对于代码

(* ---------------------------------------------------------- *)
(* --- Assertion 'A' (file input.c, line 114)             --- *)
(* ---------------------------------------------------------- *)

goal main_assert_A:
  let r_0 = 0.01e0 * 450.0e0 : real in
  let r_1 = 1.0e0 * 50.0e0 : real in
  let r_2 = ((-10.0972e0) * 50.0e0) + ((-131.494e0) * 450.0e0)
      + ((-872.5367e0) * 50.0e0) : real in
  let r_3 = (-0.0001e0) * r_2 : real in
  let r_4 = ((-0.0531e0) * 450.0e0) + ((-0.0604e0) * 50.0e0)
      + (0.9974e0 * 50.0e0) + (0.0247e0 * r_2) : real in
  let r_5 = (-10.0972e0) * r_4 : real in
  let r_6 = ((-0.0003e0) * 450.0e0) + (0.01e0 * 50.0e0)
      + (0.9997e0 * 450.0e0) + (0.0001e0 * r_2) : real in
  let r_7 = (-131.494e0) * r_6 : real in
  let r_8 = 0.01e0 * r_6 : real in
  let r_9 = (-0.0003e0) * r_6 : real in
  let r_10 = 0.01e0 * r_4 : real in
  let r_11 = 0.9997e0 * r_6 : real in
  let r_12 = (-0.0531e0) * r_6 : real in
  let r_13 = (-0.0604e0) * r_4 : real in
  let r_14 = 0.9974e0 * r_4 : real in
  forall erraA_0 : real.
  let r_15 = erraA_0 + r_0 + r_1 + r_3 : real in
  let r_16 = r_5 + r_7 + ((-872.5367e0) * r_15) : real in
  let r_17 = r_8 + (1.0e0 * r_15) + ((-0.0001e0) * r_16) : real in
  let r_18 = r_9 + r_10 + r_11 + (0.0001e0 * r_16) : real in
  let r_19 = r_12 + r_13 + r_14 + (0.0247e0 * r_16) : real in
  let r_20 = ((-872.5367e0) * r_17) + ((-10.0972e0) * r_19)
      + ((-131.494e0) * r_18) : real in
  let r_21 = (1.0e0 * r_17) + (0.01e0 * r_18)
      + ((-0.0001e0) * r_20) : real in
  let r_22 = ((-0.0003e0) * r_18) + (0.01e0 * r_19) + (0.9997e0 * r_18)
      + (0.0001e0 * r_20) : real in
  let r_23 = ((-0.0531e0) * r_18) + ((-0.0604e0) * r_19) + (0.9974e0 * r_19)
      + (0.0247e0 * r_20) : real in
  let r_24 = ((-872.5367e0) * r_21) + ((-10.0972e0) * r_23)
      + ((-131.494e0) * r_22) : real in
  let r_25 = (1.0e0 * r_21) + (0.01e0 * r_22)
      + ((-0.0001e0) * r_24) : real in
  let r_26 = ((-0.0003e0) * r_22) + (0.01e0 * r_23) + (0.9997e0 * r_22)
      + (0.0001e0 * r_24) : real in
  let r_27 = ((-0.0531e0) * r_22) + ((-0.0604e0) * r_23) + (0.9974e0 * r_23)
      + (0.0247e0 * r_24) : real in
  let r_28 = ((-872.5367e0) * r_25) + ((-10.0972e0) * r_27)
      + ((-131.494e0) * r_26) : real in
  let r_29 = (1.0e0 * r_25) + (0.01e0 * r_26)
      + ((-0.0001e0) * r_28) : real in
  let r_30 = ((-0.0003e0) * r_26) + (0.01e0 * r_27) + (0.9997e0 * r_26)
      + (0.0001e0 * r_28) : real in
  let r_31 = ((-0.0531e0) * r_26) + ((-0.0604e0) * r_27) + (0.9974e0 * r_27)
      + (0.0247e0 * r_28) : real in
  let r_32 = ((-872.5367e0) * r_29) + ((-10.0972e0) * r_31)
      + ((-131.494e0) * r_30) : real in
  let r_33 = (1.0e0 * r_29) + (0.01e0 * r_30)
      + ((-0.0001e0) * r_32) : real in
  let r_34 = ((-0.0003e0) * r_30) + (0.01e0 * r_31) + (0.9997e0 * r_30)
      + (0.0001e0 * r_32) : real in
  let r_35 = ((-0.0531e0) * r_30) + ((-0.0604e0) * r_31) + (0.9974e0 * r_31)
      + (0.0247e0 * r_32) : real in
  let r_36 = ((-872.5367e0) * r_33) + ((-10.0972e0) * r_35)
      + ((-131.494e0) * r_34) : real in
  let r_37 = (1.0e0 * r_33) + (0.01e0 * r_34)
      + ((-0.0001e0) * r_36) : real in
  let r_38 = ((-0.0003e0) * r_34) + (0.01e0 * r_35) + (0.9997e0 * r_34)
      + (0.0001e0 * r_36) : real in
  let r_39 = ((-0.0531e0) * r_34) + ((-0.0604e0) * r_35) + (0.9974e0 * r_35)
      + (0.0247e0 * r_36) : real in
  let r_40 = ((-872.5367e0) * r_37) + ((-10.0972e0) * r_39)
      + ((-131.494e0) * r_38) : real in
  let r_41 = (1.0e0 * r_37) + (0.01e0 * r_38)
      + ((-0.0001e0) * r_40) : real in
  let r_42 = ((-0.0003e0) * r_38) + (0.01e0 * r_39) + (0.9997e0 * r_38)
      + (0.0001e0 * r_40) : real in
  let r_43 = ((-0.0531e0) * r_38) + ((-0.0604e0) * r_39) + (0.9974e0 * r_39)
      + (0.0247e0 * r_40) : real in
  let r_44 = ((-872.5367e0) * r_41) + ((-10.0972e0) * r_43)
      + ((-131.494e0) * r_42) : real in
  let r_45 = (1.0e0 * r_41) + (0.01e0 * r_42)
      + ((-0.0001e0) * r_44) : real in
  let r_46 = ((-0.0003e0) * r_42) + (0.01e0 * r_43) + (0.9997e0 * r_42)
      + (0.0001e0 * r_44) : real in
  let r_47 = ((-0.0531e0) * r_42) + ((-0.0604e0) * r_43) + (0.9974e0 * r_43)
      + (0.0247e0 * r_44) : real in
  let r_48 = ((-872.5367e0) * r_45) + ((-10.0972e0) * r_47)
      + ((-131.494e0) * r_46) : real in
  let r_49 = (1.0e0 * r_45) + (0.01e0 * r_46)
      + ((-0.0001e0) * r_48) : real in
  let r_50 = ((-0.0003e0) * r_46) + (0.01e0 * r_47) + (0.9997e0 * r_46)
      + (0.0001e0 * r_48) : real in
  let r_51 = ((-0.0531e0) * r_46) + ((-0.0604e0) * r_47) + (0.9974e0 * r_47)
      + (0.0247e0 * r_48) : real in
  let r_52 = ((-872.5367e0) * r_49) + ((-10.0972e0) * r_51)
      + ((-131.494e0) * r_50) : real in
  let r_53 = (1.0e0 * r_49) + (0.01e0 * r_50)
      + ((-0.0001e0) * r_52) : real in
  let r_54 = ((-0.0003e0) * r_50) + (0.01e0 * r_51) + (0.9997e0 * r_50)
      + (0.0001e0 * r_52) : real in
  let r_55 = ((-0.0531e0) * r_50) + ((-0.0604e0) * r_51) + (0.9974e0 * r_51)
      + (0.0247e0 * r_52) : real in
  let r_56 = ((-872.5367e0) * r_53) + ((-10.0972e0) * r_55)
      + ((-131.494e0) * r_54) : real in
  let r_57 = (1.0e0 * r_53) + (0.01e0 * r_54)
      + ((-0.0001e0) * r_56) : real in
  let r_58 = ((-0.0003e0) * r_54) + (0.01e0 * r_55) + (0.9997e0 * r_54)
      + (0.0001e0 * r_56) : real in
  let r_59 = ((-0.0531e0) * r_54) + ((-0.0604e0) * r_55) + (0.9974e0 * r_55)
      + (0.0247e0 * r_56) : real in
  let r_60 = ((-872.5367e0) * r_57) + ((-10.0972e0) * r_59)
      + ((-131.494e0) * r_58) : real in
  let r_61 = (1.0e0 * r_57) + (0.01e0 * r_58)
      + ((-0.0001e0) * r_60) : real in
  let r_62 = ((-0.0003e0) * r_58) + (0.01e0 * r_59) + (0.9997e0 * r_58)
      + (0.0001e0 * r_60) : real in
  let r_63 = ((-0.0531e0) * r_58) + ((-0.0604e0) * r_59) + (0.9974e0 * r_59)
      + (0.0247e0 * r_60) : real in
  let r_64 = ((-872.5367e0) * r_61) + ((-10.0972e0) * r_63)
      + ((-131.494e0) * r_62) : real in
  let r_65 = (1.0e0 * r_61) + (0.01e0 * r_62)
      + ((-0.0001e0) * r_64) : real in
  let r_66 = ((-0.0003e0) * r_62) + (0.01e0 * r_63) + (0.9997e0 * r_62)
      + (0.0001e0 * r_64) : real in
  let r_67 = ((-0.0531e0) * r_62) + ((-0.0604e0) * r_63) + (0.9974e0 * r_63)
      + (0.0247e0 * r_64) : real in
  let r_68 = ((-872.5367e0) * r_65) + ((-10.0972e0) * r_67)
      + ((-131.494e0) * r_66) : real in
  let r_69 = (1.0e0 * r_65) + (0.01e0 * r_66)
      + ((-0.0001e0) * r_68) : real in
  let r_70 = ((-0.0003e0) * r_66) + (0.01e0 * r_67) + (0.9997e0 * r_66)
      + (0.0001e0 * r_68) : real in
  let r_71 = ((-0.0531e0) * r_66) + ((-0.0604e0) * r_67) + (0.9974e0 * r_67)
      + (0.0247e0 * r_68) : real in
  let r_72 = ((-872.5367e0) * r_69) + ((-10.0972e0) * r_71)
      + ((-131.494e0) * r_70) : real in
  let r_73 = (1.0e0 * r_69) + (0.01e0 * r_70)
      + ((-0.0001e0) * r_72) : real in
  let r_74 = ((-0.0003e0) * r_70) + (0.01e0 * r_71) + (0.9997e0 * r_70)
      + (0.0001e0 * r_72) : real in
  let r_75 = ((-0.0531e0) * r_70) + ((-0.0604e0) * r_71) + (0.9974e0 * r_71)
      + (0.0247e0 * r_72) : real in
  let r_76 = ((-872.5367e0) * r_73) + ((-10.0972e0) * r_75)
      + ((-131.494e0) * r_74) : real in
  let r_77 = (1.0e0 * r_73) + (0.01e0 * r_74)
      + ((-0.0001e0) * r_76) : real in
  let r_78 = ((-0.0003e0) * r_74) + (0.01e0 * r_75) + (0.9997e0 * r_74)
      + (0.0001e0 * r_76) : real in
  let r_79 = ((-0.0531e0) * r_74) + ((-0.0604e0) * r_75) + (0.9974e0 * r_75)
      + (0.0247e0 * r_76) : real in
  let r_80 = ((-872.5367e0) * r_77) + ((-10.0972e0) * r_79)
      + ((-131.494e0) * r_78) : real in
  let r_81 = (1.0e0 * r_77) + (0.01e0 * r_78)
      + ((-0.0001e0) * r_80) : real in
  let r_82 = ((-0.0003e0) * r_78) + (0.01e0 * r_79) + (0.9997e0 * r_78)
      + (0.0001e0 * r_80) : real in
  let r_83 = ((-0.0531e0) * r_78) + ((-0.0604e0) * r_79) + (0.9974e0 * r_79)
      + (0.0247e0 * r_80) : real in
  let r_84 = ((-872.5367e0) * r_81) + ((-10.0972e0) * r_83)
      + ((-131.494e0) * r_82) : real in
  let r_85 = (-0.0001e0) * r_84 : real in
  let r_86 = (1.0e0 * r_81) + (0.01e0 * r_82) + r_85 : real in
  let r_87 = ((-0.0003e0) * r_82) + (0.01e0 * r_83) + (0.9997e0 * r_82)
      + (0.0001e0 * r_84) : real in
  let r_88 = r_85 + (1.0e0 * r_86) + (0.01e0 * r_87) : real in
  is_float32(erraA_0) ->
  is_float32(r_15) ->
  is_float32(r_16) ->
  is_float32(r_17) ->
  is_float32(r_18) ->
  is_float32(r_19) ->
  is_float32(r_20) ->
  is_float32(r_21) ->
  is_float32(r_22) ->
  is_float32(r_23) ->
  is_float32(r_24) ->
  is_float32(r_25) ->
  is_float32(r_26) ->
  is_float32(r_27) ->
  is_float32(r_28) ->
  is_float32(r_29) ->
  is_float32(r_30) ->
  is_float32(r_31) ->
  is_float32(r_32) ->
  is_float32(r_33) ->
  is_float32(r_34) ->
  is_float32(r_35) ->
  is_float32(r_36) ->
  is_float32(r_37) ->
  is_float32(r_38) ->
  is_float32(r_39) ->
  is_float32(r_40) ->
  is_float32(r_41) ->
  is_float32(r_42) ->
  is_float32(r_43) ->
  is_float32(r_44) ->
  is_float32(r_45) ->
  is_float32(r_46) ->
  is_float32(r_47) ->
  is_float32(r_48) ->
  is_float32(r_49) ->
  is_float32(r_50) ->
  is_float32(r_51) ->
  is_float32(r_52) ->
  is_float32(r_53) ->
  is_float32(r_54) ->
  is_float32(r_55) ->
  is_float32(r_56) ->
  is_float32(r_57) ->
  is_float32(r_58) ->
  is_float32(r_59) ->
  is_float32(r_60) ->
  is_float32(r_61) ->
  is_float32(r_62) ->
  is_float32(r_63) ->
  is_float32(r_64) ->
  is_float32(r_65) ->
  is_float32(r_66) ->
  is_float32(r_67) ->
  is_float32(r_68) ->
  is_float32(r_69) ->
  is_float32(r_70) ->
  is_float32(r_71) ->
  is_float32(r_72) ->
  is_float32(r_73) ->
  is_float32(r_74) ->
  is_float32(r_75) ->
  is_float32(r_76) ->
  is_float32(r_77) ->
  is_float32(r_78) ->
  is_float32(r_79) ->
  is_float32(r_80) ->
  is_float32(r_81) ->
  is_float32(r_82) ->
  is_float32(r_83) ->
  is_float32(r_84) ->
  is_float32(r_86) ->
  is_float32(r_87) ->
  is_float32(((-0.0531e0) * r_82) + ((-0.0604e0) * r_83) + (0.9974e0 * r_83)
    + (0.0247e0 * r_84)) ->
  is_float32(r_88) ->
  (r_88 < 36.0)

我想删除所有以 is_float32 开头的行。 所以最终的代码应该是

    (* ---------------------------------------------------------- *)
(* --- Assertion 'A' (file input.c, line 114)             --- *)
(* ---------------------------------------------------------- *)

goal main_assert_A:
  let r_0 = 0.01e0 * 450.0e0 : real in
  let r_1 = 1.0e0 * 50.0e0 : real in
  let r_2 = ((-10.0972e0) * 50.0e0) + ((-131.494e0) * 450.0e0)
      + ((-872.5367e0) * 50.0e0) : real in
  let r_3 = (-0.0001e0) * r_2 : real in
  let r_4 = ((-0.0531e0) * 450.0e0) + ((-0.0604e0) * 50.0e0)
      + (0.9974e0 * 50.0e0) + (0.0247e0 * r_2) : real in
  let r_5 = (-10.0972e0) * r_4 : real in
  let r_6 = ((-0.0003e0) * 450.0e0) + (0.01e0 * 50.0e0)
      + (0.9997e0 * 450.0e0) + (0.0001e0 * r_2) : real in
  let r_7 = (-131.494e0) * r_6 : real in
  let r_8 = 0.01e0 * r_6 : real in
  let r_9 = (-0.0003e0) * r_6 : real in
  let r_10 = 0.01e0 * r_4 : real in
  let r_11 = 0.9997e0 * r_6 : real in
  let r_12 = (-0.0531e0) * r_6 : real in
  let r_13 = (-0.0604e0) * r_4 : real in
  let r_14 = 0.9974e0 * r_4 : real in
  forall erraA_0 : real.
  let r_15 = erraA_0 + r_0 + r_1 + r_3 : real in
  let r_16 = r_5 + r_7 + ((-872.5367e0) * r_15) : real in
  let r_17 = r_8 + (1.0e0 * r_15) + ((-0.0001e0) * r_16) : real in
  let r_18 = r_9 + r_10 + r_11 + (0.0001e0 * r_16) : real in
  let r_19 = r_12 + r_13 + r_14 + (0.0247e0 * r_16) : real in
  let r_20 = ((-872.5367e0) * r_17) + ((-10.0972e0) * r_19)
      + ((-131.494e0) * r_18) : real in
  let r_21 = (1.0e0 * r_17) + (0.01e0 * r_18)
      + ((-0.0001e0) * r_20) : real in
  let r_22 = ((-0.0003e0) * r_18) + (0.01e0 * r_19) + (0.9997e0 * r_18)
      + (0.0001e0 * r_20) : real in
  let r_23 = ((-0.0531e0) * r_18) + ((-0.0604e0) * r_19) + (0.9974e0 * r_19)
      + (0.0247e0 * r_20) : real in
  let r_24 = ((-872.5367e0) * r_21) + ((-10.0972e0) * r_23)
      + ((-131.494e0) * r_22) : real in
  let r_25 = (1.0e0 * r_21) + (0.01e0 * r_22)
      + ((-0.0001e0) * r_24) : real in
  let r_26 = ((-0.0003e0) * r_22) + (0.01e0 * r_23) + (0.9997e0 * r_22)
      + (0.0001e0 * r_24) : real in
  let r_27 = ((-0.0531e0) * r_22) + ((-0.0604e0) * r_23) + (0.9974e0 * r_23)
      + (0.0247e0 * r_24) : real in
  let r_28 = ((-872.5367e0) * r_25) + ((-10.0972e0) * r_27)
      + ((-131.494e0) * r_26) : real in
  let r_29 = (1.0e0 * r_25) + (0.01e0 * r_26)
      + ((-0.0001e0) * r_28) : real in
  let r_30 = ((-0.0003e0) * r_26) + (0.01e0 * r_27) + (0.9997e0 * r_26)
      + (0.0001e0 * r_28) : real in
  let r_31 = ((-0.0531e0) * r_26) + ((-0.0604e0) * r_27) + (0.9974e0 * r_27)
      + (0.0247e0 * r_28) : real in
  let r_32 = ((-872.5367e0) * r_29) + ((-10.0972e0) * r_31)
      + ((-131.494e0) * r_30) : real in
  let r_33 = (1.0e0 * r_29) + (0.01e0 * r_30)
      + ((-0.0001e0) * r_32) : real in
  let r_34 = ((-0.0003e0) * r_30) + (0.01e0 * r_31) + (0.9997e0 * r_30)
      + (0.0001e0 * r_32) : real in
  let r_35 = ((-0.0531e0) * r_30) + ((-0.0604e0) * r_31) + (0.9974e0 * r_31)
      + (0.0247e0 * r_32) : real in
  let r_36 = ((-872.5367e0) * r_33) + ((-10.0972e0) * r_35)
      + ((-131.494e0) * r_34) : real in
  let r_37 = (1.0e0 * r_33) + (0.01e0 * r_34)
      + ((-0.0001e0) * r_36) : real in
  let r_38 = ((-0.0003e0) * r_34) + (0.01e0 * r_35) + (0.9997e0 * r_34)
      + (0.0001e0 * r_36) : real in
  let r_39 = ((-0.0531e0) * r_34) + ((-0.0604e0) * r_35) + (0.9974e0 * r_35)
      + (0.0247e0 * r_36) : real in
  let r_40 = ((-872.5367e0) * r_37) + ((-10.0972e0) * r_39)
      + ((-131.494e0) * r_38) : real in
  let r_41 = (1.0e0 * r_37) + (0.01e0 * r_38)
      + ((-0.0001e0) * r_40) : real in
  let r_42 = ((-0.0003e0) * r_38) + (0.01e0 * r_39) + (0.9997e0 * r_38)
      + (0.0001e0 * r_40) : real in
  let r_43 = ((-0.0531e0) * r_38) + ((-0.0604e0) * r_39) + (0.9974e0 * r_39)
      + (0.0247e0 * r_40) : real in
  let r_44 = ((-872.5367e0) * r_41) + ((-10.0972e0) * r_43)
      + ((-131.494e0) * r_42) : real in
  let r_45 = (1.0e0 * r_41) + (0.01e0 * r_42)
      + ((-0.0001e0) * r_44) : real in
  let r_46 = ((-0.0003e0) * r_42) + (0.01e0 * r_43) + (0.9997e0 * r_42)
      + (0.0001e0 * r_44) : real in
  let r_47 = ((-0.0531e0) * r_42) + ((-0.0604e0) * r_43) + (0.9974e0 * r_43)
      + (0.0247e0 * r_44) : real in
  let r_48 = ((-872.5367e0) * r_45) + ((-10.0972e0) * r_47)
      + ((-131.494e0) * r_46) : real in
  let r_49 = (1.0e0 * r_45) + (0.01e0 * r_46)
      + ((-0.0001e0) * r_48) : real in
  let r_50 = ((-0.0003e0) * r_46) + (0.01e0 * r_47) + (0.9997e0 * r_46)
      + (0.0001e0 * r_48) : real in
  let r_51 = ((-0.0531e0) * r_46) + ((-0.0604e0) * r_47) + (0.9974e0 * r_47)
      + (0.0247e0 * r_48) : real in
  let r_52 = ((-872.5367e0) * r_49) + ((-10.0972e0) * r_51)
      + ((-131.494e0) * r_50) : real in
  let r_53 = (1.0e0 * r_49) + (0.01e0 * r_50)
      + ((-0.0001e0) * r_52) : real in
  let r_54 = ((-0.0003e0) * r_50) + (0.01e0 * r_51) + (0.9997e0 * r_50)
      + (0.0001e0 * r_52) : real in
  let r_55 = ((-0.0531e0) * r_50) + ((-0.0604e0) * r_51) + (0.9974e0 * r_51)
      + (0.0247e0 * r_52) : real in
  let r_56 = ((-872.5367e0) * r_53) + ((-10.0972e0) * r_55)
      + ((-131.494e0) * r_54) : real in
  let r_57 = (1.0e0 * r_53) + (0.01e0 * r_54)
      + ((-0.0001e0) * r_56) : real in
  let r_58 = ((-0.0003e0) * r_54) + (0.01e0 * r_55) + (0.9997e0 * r_54)
      + (0.0001e0 * r_56) : real in
  let r_59 = ((-0.0531e0) * r_54) + ((-0.0604e0) * r_55) + (0.9974e0 * r_55)
      + (0.0247e0 * r_56) : real in
  let r_60 = ((-872.5367e0) * r_57) + ((-10.0972e0) * r_59)
      + ((-131.494e0) * r_58) : real in
  let r_61 = (1.0e0 * r_57) + (0.01e0 * r_58)
      + ((-0.0001e0) * r_60) : real in
  let r_62 = ((-0.0003e0) * r_58) + (0.01e0 * r_59) + (0.9997e0 * r_58)
      + (0.0001e0 * r_60) : real in
  let r_63 = ((-0.0531e0) * r_58) + ((-0.0604e0) * r_59) + (0.9974e0 * r_59)
      + (0.0247e0 * r_60) : real in
  let r_64 = ((-872.5367e0) * r_61) + ((-10.0972e0) * r_63)
      + ((-131.494e0) * r_62) : real in
  let r_65 = (1.0e0 * r_61) + (0.01e0 * r_62)
      + ((-0.0001e0) * r_64) : real in
  let r_66 = ((-0.0003e0) * r_62) + (0.01e0 * r_63) + (0.9997e0 * r_62)
      + (0.0001e0 * r_64) : real in
  let r_67 = ((-0.0531e0) * r_62) + ((-0.0604e0) * r_63) + (0.9974e0 * r_63)
      + (0.0247e0 * r_64) : real in
  let r_68 = ((-872.5367e0) * r_65) + ((-10.0972e0) * r_67)
      + ((-131.494e0) * r_66) : real in
  let r_69 = (1.0e0 * r_65) + (0.01e0 * r_66)
      + ((-0.0001e0) * r_68) : real in
  let r_70 = ((-0.0003e0) * r_66) + (0.01e0 * r_67) + (0.9997e0 * r_66)
      + (0.0001e0 * r_68) : real in
  let r_71 = ((-0.0531e0) * r_66) + ((-0.0604e0) * r_67) + (0.9974e0 * r_67)
      + (0.0247e0 * r_68) : real in
  let r_72 = ((-872.5367e0) * r_69) + ((-10.0972e0) * r_71)
      + ((-131.494e0) * r_70) : real in
  let r_73 = (1.0e0 * r_69) + (0.01e0 * r_70)
      + ((-0.0001e0) * r_72) : real in
  let r_74 = ((-0.0003e0) * r_70) + (0.01e0 * r_71) + (0.9997e0 * r_70)
      + (0.0001e0 * r_72) : real in
  let r_75 = ((-0.0531e0) * r_70) + ((-0.0604e0) * r_71) + (0.9974e0 * r_71)
      + (0.0247e0 * r_72) : real in
  let r_76 = ((-872.5367e0) * r_73) + ((-10.0972e0) * r_75)
      + ((-131.494e0) * r_74) : real in
  let r_77 = (1.0e0 * r_73) + (0.01e0 * r_74)
      + ((-0.0001e0) * r_76) : real in
  let r_78 = ((-0.0003e0) * r_74) + (0.01e0 * r_75) + (0.9997e0 * r_74)
      + (0.0001e0 * r_76) : real in
  let r_79 = ((-0.0531e0) * r_74) + ((-0.0604e0) * r_75) + (0.9974e0 * r_75)
      + (0.0247e0 * r_76) : real in
  let r_80 = ((-872.5367e0) * r_77) + ((-10.0972e0) * r_79)
      + ((-131.494e0) * r_78) : real in
  let r_81 = (1.0e0 * r_77) + (0.01e0 * r_78)
      + ((-0.0001e0) * r_80) : real in
  let r_82 = ((-0.0003e0) * r_78) + (0.01e0 * r_79) + (0.9997e0 * r_78)
      + (0.0001e0 * r_80) : real in
  let r_83 = ((-0.0531e0) * r_78) + ((-0.0604e0) * r_79) + (0.9974e0 * r_79)
      + (0.0247e0 * r_80) : real in
  let r_84 = ((-872.5367e0) * r_81) + ((-10.0972e0) * r_83)
      + ((-131.494e0) * r_82) : real in
  let r_85 = (-0.0001e0) * r_84 : real in
  let r_86 = (1.0e0 * r_81) + (0.01e0 * r_82) + r_85 : real in
  let r_87 = ((-0.0003e0) * r_82) + (0.01e0 * r_83) + (0.9997e0 * r_82)
      + (0.0001e0 * r_84) : real in
  let r_88 = r_85 + (1.0e0 * r_86) + (0.01e0 * r_87) : real in
  (r_88 < 36.0)

我的问题类似于sed delete multiple lines。但我无法理解这个解决方案并适用于我的问题。

4 个答案:

答案 0 :(得分:3)

这个awk可以胜任:

awk '/^is_float32/{d=1} !d; /->[[:space:]]*$/{d=0}' file

let r_88 = r_85 + (1.0e0 * r_86) + (0.01e0 * r_87) : real in
(r_88 < 36.0)

awk在开始时遇到d时会设置一个标记is_float32,并在找到->并在结尾处找到0个或更多个空格时重置它线。它仅在未设置标志时打印行,即使用!d检查。

答案 1 :(得分:2)

您可以试试sed

sed '/^abcd/{:loop; /->$/d; N; b loop}' file

<强>测试

$ cat file
let r_88 = r_85 + (1.0e0 * r_86) + (0.01e0 * r_87) : real in
is_float32(erraA_0) ->
is_float32(((-0.0531e0) * r_82) + ((-0.0604e0) * r_83) + (0.9974e0 * r_83)
+ (0.0247e0 * r_84)) ->
(r_88 < 36.0)

$ sed '/^is_float32/{:loop; /->$/d; N; b loop}' file
let r_88 = r_85 + (1.0e0 * r_86) + (0.01e0 * r_87) : real in
(r_88 < 36.0)

答案 2 :(得分:0)

awk -v RS='->' '{$1=$1;} !/^abcd/' del
general code segment 1
general code segment 2

答案 3 :(得分:0)

我会使用awk's记录分隔符:

awk '!/^abcd/' RS='->\n' ORS='->\n' file

上面的脚本将输入拆分为由-> +换行符分隔的记录。如果这些记录不以abcd开头,则会打印出来。

输出:

general code segment 1 ->
general code segment 2 ->

看起来你的文件有Windows样式行结尾,在这种情况下你需要使用:

awk '!/^abcd/' RS='->\r\n' ORS='->\r\n' file