Hi group,
Yes, dashes not tildes. I think that's what I meant :-)
I'd really like to see your post on changing characters in filenames too
darnel. That's one I'd really like to have in the toolbag. It's about time I
started working through some of these magical incantations, and learning a
little more about the type of tools available when not using MS.
That's that little character replacement job out of the way. Crumbs, about
20,000 characters to replace in both the filenames and internal references.
I sort of feel that I might not be doing the right thing as it places me
back at square 1 with all the search engines. From the number of people that
have made the same suggestion, and by the quality of the advice that they
all seem to offer in this group, I'm sure it's important and the right thing
to be doing. I really appreciate the technical advice and especially the
encouragement. It might not have gotten done otherwise, and I might have
been missing out on much improved SE results as a consequence.
Regards,
Murray R. Van Luyn.
--
32°02'14.23"S 115°53'21.30"E
http://www.review-a-gadget.com/ http://members.iinet.net.au/~vanluynm/
"darnel" <EMAIL REMOVED> wrote in message
news:EMAIL REMOVED ups.com...
> #!/usr/bin/perl -i
>
> $to = pop @ARGV;
> $from = pop @ARGV;
>
> while(<>)
> {
> s/$from/$to/g;
> print $_;
> }
>
> ...be careful with this script. It writes back over top the files
> it operates on. Backup your directory tree first:
>
> tar -cvzf saved.tgz your_chosen_directory
>
> or change the first line of the script.
> Look at:
> #!/usr/bin/perl -i .....the minus i switch (-i)
> tells perl to write back over top the files it
> operates on (instead of writing to stdout)
> If you use -i.bak as the switch,
> perl will save all the original copies as file.bak
> before changing file.
>
> Another way is to eliminate the -i switch entirely
> Then the sh command becomes:
>
> #!/bin/sh
> for file in `find . -name "*\.html"`
> do
> rrepstr $file > /tmp/$file
> cp /tmp/$file $file
> done
>
> now you have a copy of the original, unchanged file
> in /tmp, and the changed file sitting where it was
> originally
>
> In another post I showed how to change underscores
> to dashes in the file names, rather than the file contents.
> That's important too. And trickier.
>
> rrepstr will change any character to any other.
> It doesn't have to be underscores and dashes.
>
>
>