Some questions about global substitution
发表于 : 2011-08-05 17:40
Some questions about substitution, to the following text segment:
add_port state M1/PDDS -state {m1 1.0} -state {m2 0.9} -state {m3 off}
create_pst pst1 -supplies {SW1/sout M1/PDDS}
add_pst_state state1 -pst pst1 -state {0.7 0.9}
add_pst_state state2 -pst pst1 -state {0.8 0.9}
add_pst_state state3 -pst pst1 -state {0.8 1.0}
add_pst_state state4 -pst pst1 -state {off off}
# explicit directive to say no isolation
set_isolation iso1 -domain PDM -no_isolation
I can use :%s/^.*\n// or :g,^,d to delete all lines, while why I
can not delete all lines by :g,^,s/^.*\n// or :g,add,s/^.*\n// to
delete all lines containing word “add”
I am confuse about this? Would someone give me some explanations, and
can you recommend some useful tips about the “global” command in vim?
Thanks very much.
add_port state M1/PDDS -state {m1 1.0} -state {m2 0.9} -state {m3 off}
create_pst pst1 -supplies {SW1/sout M1/PDDS}
add_pst_state state1 -pst pst1 -state {0.7 0.9}
add_pst_state state2 -pst pst1 -state {0.8 0.9}
add_pst_state state3 -pst pst1 -state {0.8 1.0}
add_pst_state state4 -pst pst1 -state {off off}
# explicit directive to say no isolation
set_isolation iso1 -domain PDM -no_isolation
I can use :%s/^.*\n// or :g,^,d to delete all lines, while why I
can not delete all lines by :g,^,s/^.*\n// or :g,add,s/^.*\n// to
delete all lines containing word “add”
I am confuse about this? Would someone give me some explanations, and
can you recommend some useful tips about the “global” command in vim?
Thanks very much.