Currently Being ModeratedJul 1, 2012 1:23 AM (in response to Donot Haveone)
If that's all you want to do then here's the pertinent sed command to do it:
sed -e 's,www.old_domain_name/user/my_username,my_new_domain_name,'
Syntax is a bit simpler when you don't use slashes as the sed substitute delimiters. You can use anything. Here I used commas.
Currently Being ModeratedJul 1, 2012 1:31 AM (in response to X423424X)
Actually, it's not fixed. I got excited too quickly after the first file I clicked looked correct--the first file in the subdirectory.
I see no indication in terminal that the process is going or ending--no sense of when I can close terminal and move on.
Checking the directory in finder shows no updates to 'date modified' for any of the files.
So how do I know if it is in progress, or done working, aside from opening random files to see if they're 'done'?
Currently Being ModeratedJul 1, 2012 1:54 AM (in response to Donot Haveone)
Put it in a text file and trace it (and I don't recommend using textedit, use a real text editor like TextWrangler or BBEdit).
Say you create a text file called my-script. In terminal
chmod +x my_script
Now it's an executable script. You can type my_script from the terminal and execute it.
Of course that's the basic scheme. I leave it to you to get the pathnames corrrect.
All this is leading to the fact that if you place a
at the beginning of the script you will see each command as it is executed. I would do this on a small subset of the data until you fix the problems.
Alternatively it's only about 8 command lines so just type them on the terminal to see what happens that way.
I only gave you the central sed to edit the strings you presented in your original post. I didn't check your script and assumed you could figure out the appropriate placement.
Currently Being ModeratedJul 1, 2012 2:12 AM (in response to Donot Haveone)
I may have left out a few steps but maybe what I hav below is what you need:
while read f; do
sed -e 's,www.old_domain_name/user/my_username,my_new_domain_name,' < "$1/$f" >"$2/$f"
done< <(ls "$1")
This is a script as I described previously. It takes two arguments. The first is the path to the input directory and the second is the path to the output directory. So if my-script was the name of this script you would execute something like:
my-script WEB new-web
Hope this helps.
(and again it is up to you to specify the pathnames to the script and the input/output directory pathnames correctly)
Note the cryptic while loop is done to allow for the possibility that the filenames in the source directory having special characters (like blanks in them).
Currently Being ModeratedJul 1, 2012 2:15 AM (in response to X423424X)
You made very reasonable assumptions about my unix literacy, but that overestimated my understanding of all this by quite a lot!
I have to stop for the moment but will come back to this tomorrow.
Currently Being ModeratedJul 1, 2012 2:53 AM (in response to Donot Haveone)
Download the free TextWrangler utility and use it multi-file search and replace capabilities.
It will be a little more tedious than a script, but more comfortable as it is a GUI text editor.
Currently Being ModeratedJul 1, 2012 8:04 AM (in response to BobHarris)
That sounds excellent. Will try that and report back.
Currently Being ModeratedJul 1, 2012 2:34 PM (in response to Donot Haveone)
textWrangler did it! 10 minutes and the site* is migrated and functional!
a collection of recipes, stuff about aquarium fish, etc.