W
walala
Suppose I want to do conditional search & replacement:
I have the following input text file:
-------------------------------------------------------------------
_INST1832 B_1 59 135.301588688164E-18 M=1.0
_INST1833 S_4 47 52 VDD! PCH L=239.99999143598E-9 W=3.99999998990097E-6
+AD=2.04320002757108E-12 AS=1.58200004745507E-12 PD=5.36000015927129E-6
+PS=829.999976303952E-9 NRD=+2.50000001E-01 NRS=+2.50000001E-01 M=1.0
-------------------------------------------------------------------
I want to change the "_INST" in the lines where there is no "PCH" or "NCH"
patterns to "C", and change the "_INST" in the lines where there is "PCH" or
"NCH" to "M".
The result should be:
-------------------------------------------------------------------
C1832 B_1 59 135.301588688164E-18 M=1.0
M1833 S_4 47 52 VDD! PCH L=239.99999143598E-9 W=3.99999998990097E-6
+AD=2.04320002757108E-12 AS=1.58200004745507E-12 PD=5.36000015927129E-6
+PS=829.999976303952E-9 NRD=+2.50000001E-01 NRS=+2.50000001E-01 M=1.0
-------------------------------------------------------------------
What do I do? Can you give me the right "regular expression" which can do
such thing?
Thank you very much!
-Walala
I have the following input text file:
-------------------------------------------------------------------
_INST1832 B_1 59 135.301588688164E-18 M=1.0
_INST1833 S_4 47 52 VDD! PCH L=239.99999143598E-9 W=3.99999998990097E-6
+AD=2.04320002757108E-12 AS=1.58200004745507E-12 PD=5.36000015927129E-6
+PS=829.999976303952E-9 NRD=+2.50000001E-01 NRS=+2.50000001E-01 M=1.0
-------------------------------------------------------------------
I want to change the "_INST" in the lines where there is no "PCH" or "NCH"
patterns to "C", and change the "_INST" in the lines where there is "PCH" or
"NCH" to "M".
The result should be:
-------------------------------------------------------------------
C1832 B_1 59 135.301588688164E-18 M=1.0
M1833 S_4 47 52 VDD! PCH L=239.99999143598E-9 W=3.99999998990097E-6
+AD=2.04320002757108E-12 AS=1.58200004745507E-12 PD=5.36000015927129E-6
+PS=829.999976303952E-9 NRD=+2.50000001E-01 NRS=+2.50000001E-01 M=1.0
-------------------------------------------------------------------
What do I do? Can you give me the right "regular expression" which can do
such thing?
Thank you very much!
-Walala