#! /usr/bin/perl -w $pathtofiles = "/var/named/backup/"; $pathtooutfiles = "/var/named/new/"; open ( HOSTFILES, ") { chomp ( $currFile = $_ ); $execcmd = "cat $pathtofiles$currFile | sed s/207\.47\.124/173.196.1/ > $pathtooutfiles$currFile"; system ( "$execcmd" ); print "$currFile\n"; }; close HOSTFILES;