cvsed.pl - Edit files and rename files. Like sed(1)
and ed(1).
CVS is a concurrent version control system and available for multiple
platforms at http://www.cvshome.com
. This program will help changing the
content of client files Root, Repository, Entries and Tag. From
time to time there is a need to change the repository locations and this
needs immediate changin in following files:
Before:
CVS/Root /cygdrive/g/data/version-control/cvsroot CVS/Repository emacs/gnu-emacs/lisp
After:
CVS/Root /cygdrive/h/data/version-control/cvsroot CVS/Repository emacs/gnu-emacs/lisp
In the above example, the Win32 http://www.cygwin.com/ hard disk repository was changed from disk g (that possibly filled up) to a partition h. Any similar change can be carried out with any of these files. The changes to the files are made using perl code that is evaled and for the above situation the command line parameters would be:
cvsed.pl --name "/Root$" --eval "s,/g/,/h/," .
cvsed.pl --name FILE-REGEXP --eval PERL-CODE DIR [DIR DIR ..]
To move the repository from g disk to h disk for file ``Root'', when the content is ``/cygdrive/g/data/version-control/cvsroot''. With the --test options the program will only print what would happen and no actual changes are made.
cvsed.pl --test --name "/Root$" --eval "s,/g/,/h/," .
Sometimes the server has changes locations (IP) or the repository has otherwise relocated on disk.
CVS/Root file before:
foo@cvs.perl-dyndns.sourceforge.net:/cvsroot/perl-dyndns
How it sould read:
foo@cvs.perl-dyndns.sourceforge.net:/cvsroot/new/location/perl-dyndns
Now give command
cvsed.pl --test --name "/Root$" \ --eval s,:/cvsroot/,:/cvsroot/new/location/," .
As you may have already noticed, this perl script is not merely for changing the CVS administrative files, but you can use program to change whatever files in your filesystem. Say you want to correct every email in your files from OLD address to NEW address:
cvsed.pl --test --name "\.txt$" --eval 's,\Qme-old@here.com,new@there.at,'
You need the \Q quote operator to take everything literally, because for
Perl the at(@)
character is special. Remember to use single quotes in
the --eval
if you add any backslashes, so that everything are passed
as is.
<what to check in case of error or weird behavior>
No environment variables used.
None.
cvs(1)
http://www.cvshome.com/
No standards referenced.
None known.
CPAN entry is at http://cpan.perl.org/modules/by-authors/id/J/JA/JARIAALTO/ Reach author at jari.aalto@poboxes.com HomePage is at
CPAN/Administrative
None.
None.
any
$Id: cvsed.pl,v 1.1 2002/07/26 20:50:01 jaalto Exp $
Copyright (C) 2001-2002 Jari Aalto. All rights reserved. This program is free software; you can redistribute and/or modify program under the same terms as Perl itself or in terms of Gnu General Public licence v2 or later.