Re: I can do it in sed...

2005-03-17 Thread Ville Vainio
Damjan == Damjan [EMAIL PROTECTED] writes: Damjan Or, much nicer if line[:5]=='start': printing=1 Damjan if line.startswith('start'): printing=1 if line[:3]=='end': printing=0 Damjan if line.endswith('end'): printing=0 No, it's still line.startswith('end'), not

Re: I can do it in sed...

2005-03-17 Thread Ville Vainio
John == John Machin [EMAIL PROTECTED] writes: John You can get gnu Windows versions of awk sed and most other John suchlike goodies off the net ... Yeah, google for 'unxutils'. Cygwin versions of these tools can be a headache sometimes. -- Ville Vainio http://tinyurl.com/2prnb --

Re: I can do it in sed...

2005-03-17 Thread TZOTZIOY
On Wed, 16 Mar 2005 19:06:40 -0600, rumours say that Terry Hancock [EMAIL PROTECTED] might have written: snip You mean you have a text file and you want to find all the lines between a line starting with start and one starting with end. snip lines = open('myfile', 'r').readlines() printing =

Re: I can do it in sed...

2005-03-17 Thread Kent Johnson
Kotlin Sam wrote: Also, I frequently use something like s/^[A-Z]/~/ to pre-pend a tilde or some other string to the beginning of the matched string. I know how to find the matched string, but I don't know how to change the beginning of it while still keeping the matched part. Something like

Re: I can do it in sed...

2005-03-17 Thread Kotlin Sam
Thanks to everyone who answered my two questions. I have only submitted questions twice, and on both occasions the solutions were excellent, and, I'm emarrassed to say, much simpler than I thought they would be. My next goal is to be able to help someone they way y'all have helped me. Thanks

Re: I can do it in sed...

2005-03-17 Thread Bengt Richter
On Thu, 17 Mar 2005 18:37:11 -0500, Kotlin Sam [EMAIL PROTECTED] wrote: Thanks to everyone who answered my two questions. I have only submitted questions twice, and on both occasions the solutions were excellent, and, I'm emarrassed to say, much simpler than I thought they would be. My next

I can do it in sed...

2005-03-16 Thread Kotlin Sam
I have spent so much time using sed and awk that I think that way. Now, when I have to do some Python things, I am having to break out of my sed-ness and awk-ness, and it is causing me problems. I'm trying. Honest! Here are the two things that I'm trying to do: In sed, I can print every line

Re: I can do it in sed...

2005-03-16 Thread Terry Hancock
On Wednesday 16 March 2005 06:01 pm, Kotlin Sam wrote: Here are the two things that I'm trying to do: In sed, I can print every line between ^start to ^end by using /^start/,/^end/p. It's quick, easy, and doesn't take much time. Is there a way to do this easily in Python? You mean

Re: I can do it in sed...

2005-03-16 Thread John Machin
: In sed, I can print every line between ^start to ^end by using /^start/,/^end/p. It's quick, easy, and doesn't take much time. Is there a way to do this easily in Python? Also, I frequently use something like s/^[A-Z]/~/ to pre-pend a tilde or some other string to the beginning

Re: I can do it in sed...

2005-03-16 Thread Damjan
Or, much nicer if line[:5]=='start': printing=1 if line.startswith('start'): printing=1 if line[:3]=='end': printing=0 if line.endswith('end'): printing=0 -- damjan -- http://mail.python.org/mailman/listinfo/python-list