Re: Replacing text

2003-12-06 Thread John W. Krahn
Dan Anderson wrote: > > I have a script that reads text from a file and inserts text > into different places depending on what it needs to do. But I use > split to replace the text, i.e.: > > ($first_part, $second_part) = split "#INSERT#TEXT#HERE#", $document, 2; > print FILEHANDLE

RE: Replacing text

2003-12-05 Thread Tom Kinzer
Good news, Dan. That is arguably one of Perl's most famous features! Regular expresions (Perl's own) are very similar to what you would do with sed, if you are familiar with that. open IN, "< $input" or die "Unable to open $input for reading, $!, stopped"; open OUT, "> $output" or die "Unable

RE: Replacing text

2003-12-05 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > I have a script that reads text from a file and inserts text > into different places depending on what it needs to do. But I use > split to replace the text, i.e.: > > ($first_part, $second_part) = split "#INSERT#TEXT#HERE#", $document, > 2; print FILEHAND

Re: Replacing text

2003-12-05 Thread Philipp Traeder
Hi Dan, have you tried using a regular expression? I am using something like this for a similar purpose: open ($fh, $filename); # go through each line of the file while ($_ = <$fh>) { # replace globally in the default variable $_ s/#INSERT#TEXT#HERE/$text_to_insert/g; } close ($fh);

Re: replacing text in a file

2003-06-09 Thread Tassilo von Parseval
On Mon, Jun 09, 2003 at 03:22:52PM +0100 Rob Dixon wrote: > Tassilo Von Parseval wrote: > > You can use the same underlying technique from within a Perl script. You > > have to set two special variables accordingly and Perl can even do an > > inplace-edit: > > > > local $^I = 1;

Re: replacing text in a file

2003-06-09 Thread Rob Dixon
Tassilo Von Parseval wrote: > On Mon, Jun 09, 2003 at 02:46:48AM -0500 christopher j bottaro wrote: > > > what is the easiest way to replace text in a file? say i have file blah.txt > > and i want to replace some regular expression found in that file with > > something. also, i want to do this fr

RE: replacing text in a file

2003-06-09 Thread Dan Muey
> hello, > what is the easiest way to replace text in a file? say i > have file blah.txt > and i want to replace some regular expression found in that file with > something. also, i want to do this from within the perl > program, not by > invoking perl with the -e option. #!/usr/bin/perl -w

Re: replacing text in a file

2003-06-09 Thread Tassilo von Parseval
On Mon, Jun 09, 2003 at 02:46:48AM -0500 christopher j bottaro wrote: > what is the easiest way to replace text in a file? say i have file blah.txt > and i want to replace some regular expression found in that file with > something. also, i want to do this from within the perl program, not by

Re: Replacing text in only certain sections of a file.

2002-02-08 Thread Jeff 'japhy' Pinyan
On Feb 8, Steven M. Klass said: >I am having some problems and I can't seem to get it right. In short, I >want to only modify text in a specific section. That section is denoted >by the following > >*DESCRIPTION > > > >*END > This sounds like a job for the .. operator. Let's see. >Here is w

Re: replacing text, excluding what's between tags.

2001-08-24 Thread Christopher Solomon
I'm not sure exactly what you want to do... Do you want to replace all of the marked a's: On Fri, 24 Aug 2001, Danial Magid wrote: > > This is a link to another place ^ ^ ^ or do you just want to replace the word 'a'? If you just want to repl