in reply to Search and replace

You might want to elaborate on the replacement requirements. Are you trying to replace "name.come" with a complete email address? Does the file with email addresses contain one email address and no other text? Examples would help.

Also it might be easier to help if you show us the code you have so far.

--Jim

Replies are listed 'Best First'.
Re: Re: Search and replace
by rscott212 (Sexton) on Dec 02, 2001 at 01:40 UTC
    I am having a hard time getting this started.

    To explain further what I want to do, I currently have 1 file with a list of email addresses. These I am trying to use as my variables. I have another text file where I need to search for "email=john.edu" and replace with email=new_address.edu. Then I would like to save this file with the changes as new_address.txt. I have 100 email addresses in my list. I would like this process to repeat until the end of the adresses. I should have 100 new text files in this directory.

    I am new to perl and really do not know where to start. I don't know how to read in my email list and search to replace just the new email address and save the entire file before continuing with the loop.

    open (FILEHANDLE, "<$john.txt"); #open main file open (DATA, "<email_list.txt"); @lines = <DATA>; $/ = "\"; while (<DATA>) { #PROCESS AND UPDATE A RECORD }
    If you can think of a better way to do this, please let me know. Thanks!!!!