0

OK - I'm new to all of this. I need to create multiple files from a list.

For example
Myfile1.php becomes myfile2.php, myfile3.php, myfile4.php

When my list is
2
3
4

I also need to do a global find replace. I have found enough examples of doing that online I think I will be OK.

In an ideal world I would be able to do this with one script.

Essentially I am creating unique PHP scripts for people, based upon a list. The filename will be the same value that I will also use for my search & replace.

So - Is a shell script the way to go? I have installed Cygwin installed and am using windoze. Whats a good place to start? Any pointers as to which commands to google?

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Brik
0

Hey there,

For the above example - filename generation - you could do

#!/bin/ksh

filename=`echo $0|sed 's/^.*\///'`

while read line
do
     new_filename=`echo $filename|sed "s/[0-9]/$line/'`
    touch $new_filename
done <FILE

I'm such a lazy scripter ;)

Should do the trick though

, Mike

0

Thanks!!! I was just coming back here to remove or edit my question. Found a MUCH better way to do what I want to do.

One PHP file that is dynamic versus 300+ static.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.