in reply to Re: Make a copy of a line and add it back to the same file
in thread Make a copy of a line and add it back to the same file

'course, if you're aiming for something a bit less complicated, there's always:
perl -pi -e 's/old text/new text/' filename
...assuming, of course, that that's what you're trying to accomplish (the original question wasn't all that clear on that point)

Replies are listed 'Best First'.
Re: Re: Re: Make a copy of a line and add it back to the same file
by Anonymous Monk on Aug 26, 2002 at 23:09 UTC
    the_pusher_robot: Basically Iam reading a bunch of lines from a file. One of the line looks like: cdsadmin -t -O :c:\data"; I want to make a copy of this line, then change the the "-t" to "-d" in the copy. I then want to add this new line(copy) back to the file. The file now contains the original lines plus the new one.
      ah, I see. In that case, don't use my solution :-)