#! /usr/bin/perl -w # scr60.pl # How to substitute a pattern of text string from one to another # at the incoming lines globally and quickly? # Please use substitute feature. # # s/old_pattern/new_pattern/g; # # The last "g" means globally, all occations. # mkdir("RESULT", 0777); ## Make a folder in the current directory for preparation. open (IN, "Ref.txt"); open (OUT, ">RESULT/Ref.txt"); while (<IN>){ if(/http/){ ## Here! Here! Quick and easy Substitution. s/255.255.255.0/www.netaddress.net/g; print OUT $_; }else{ print OUT $_; } } ### closing while-loop close(IN); close(OUT);