The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-15-2008
McLan McLan is offline
Registered User
 

Join Date: Mar 2008
Posts: 18
Find/replace to new file: ksh -> perl

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?
Reply With Quote
Forum Sponsor