in reply to Search and replace on a 130000+ line file.
open (INFILE,"<infile.txt"); open (OUTFILE, ">outfile.txt); while (<INFILE>) { # $_ will hold one line of your file, and the loop will (slowly) go t +hrough your entire file #Mangle $_ here e.g. s/^\+host-1-3-1-10:/$ipnum/; #print it into the other file print OUTFILE $_; }
Or variations on the above, to suit.
Update: I forgot about the ip bit. Depending on how many there are you could push them into a hash or use some database solution, as tilly didn't quite mention in the chatbox.
____________________
Jeremy
I didn't believe in evil until I dated it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search and replace on a 130000+ line file.
by tadman (Prior) on May 11, 2001 at 22:25 UTC |