Home: Perl Programming Help: Regular Expressions:
Find/replace to new file



Naresh
New User

May 15, 2008, 11:41 PM


Views: 6460
Find/replace to new file



I have korn shell script that genretaets 100 file based on template replacing the number.

The template file is as below:


Code
   

$ cat template

file number: NUMBER

The shell script is as below;


Code
   

$ cat gen.sh

#!/bin/ksh

i=1;

while ((i <= 100)); do

sed "s/NUMBER/$i/" template > file_${i}

(( i = i + 1));

done



Now I want to migrate this code into perl script called gen.pl

How can I fine replace NUMBER is template file and generate new output file?


KevinR
Veteran


May 15, 2008, 11:45 PM


Views: 6459
Re: [Naresh] Find/replace to new file

ask on www.unix.com in the 'shell scripting forum', there are a number of people with experience in various shell scripts that can do the translation from korn to perl for you.
-------------------------------------------------