I was not trying to get any output. I was trying to modify a source file in
place, I just want to replace file content text automatically. So I tried
first from python shell in linux. This is what I did:
[EMAIL PROTECTED] aut]$ python
Python 2.4.3 (#1, Oct 23 2006, 14:19:47)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import fileinput
>>> import re
>>> for line in fileinput.input("ets.AUT1",inplace=1):
... re.sub('LOOP','PRUEBALOOP',line)
...
>>>
But for an entry like the following in file "ets.AUT1":
PT_WT_INIT: LOOP
TRANS (EvtMaint,ETSL_MAINTENANCE)
TRANS (EvtTout,ETSL8)
ELSE_SLEEP
This is what I got "ets.AUT1" content like this one:
'\r\n'
'PT_WT_INIT: PRUEBALOOP\r\n'
' TRANS
(EvtMaint,ETSL_MAINTENANCE)\r\n'
' TRANS (EvtTout,ETSL8)\r\n'
' ELSE_SLEEP\r\n'
'\r\n'
The file I got as a result won't work. I just wan't the pattern replaced.
Do you know how could I do it?
Thanks again, Jon.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor