On Mon, Nov 16, 2015 at 12:38 PM, bch <brad.har...@gmail.com> wrote:

> In the immediate case, it's me tracking 3rd party vendor code which I
> depend on. I untar, add, commit. On upstream updates, I nuke the 3rd-party
> code, lay down the new release and this is where we might find renaming
> issues as I described.
>
If the file names are the same other than the version, you could strip off
the version. For example, in a script you could include:
    perl -e 'my $n = $ARGV[0]; $n =~ s/-\d+[.]\d+//; rename($ARGV[0], $n);'
$file

If all the such files share a common naming pattern, the following should
be able to find and strip off the version string from the names of all such
files (all on one line):
    find . -iregex '[a-z]+[-][0-9]+[.][0-9]+[.]txt' -type f -exec
    perl -e 'my $n = $ARGV[0]; $n =~ s/-\d+[.]\d+//; rename($ARGV[0], $n);'
    '{}' ';'

You may need to modify the pattern after -iregex to match your files.
FYI, the i in -iregex means case insensitive matching. -regex will do case
sensitive matching.

If you have trouble modifying my find command, above, to work for you, I
can create create an equivalent Perl script that should work on MS Windows,
Mac OSX, Linux and other Unix-like systems.
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to