Re: Line replace

2004-10-11 Thread Chris Devers
On Mon, 11 Oct 2004, Ramprasad A Padmanabhan wrote: > On Mon, 2004-10-11 at 16:23, Urs Wagner wrote: > > > > I should comment out lines in a text file. I have a lot of troubles > > to realize this. > > > > The lines > > Alpha(a, b, c) > > should be changed to > > # Alpha(a, b, c) > > perl -pli

RE: Line replace

2004-10-11 Thread arjun.mallik
Hai ! Open the file with any file handler and use regular expression.. This way it will work. Open (File handler name ,">>file name"); While ( $string=) { if ( $string = ~ /^Alpha\(a,b,c\)/ ) { $string = "#" . $string ; print$string ; } } Arjun -Original Messa

RE: Line replace

2004-10-11 Thread arjun.mallik
Good one liner I appreciate it .. Arjun -Original Message- From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED] Sent: Monday, October 11, 2004 4:41 PM To: Urs Wagner Cc: perl beginners Subject: Re: Line replace On Mon, 2004-10-11 at 16:23, Urs Wagner wrote: > Hello &g

Re: Line replace

2004-10-11 Thread Ramprasad A Padmanabhan
On Mon, 2004-10-11 at 16:23, Urs Wagner wrote: > Hello > > I should comment out lines in a text file. I have a lot of troubles to > realize this. > > The lines > Alpha(a, b, c) > should be changed to > # Alpha(a, b, c) > perl -pli.BAK -e 's/(?=.*Alpha\(a, b ,c\))/#/' FILENAME HTH Ram --