NAME

cvsed.pl - Edit files and rename files. Like sed(1) and ed(1).


README

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/," .


SYNOPSIS

    cvsed.pl --name FILE-REGEXP --eval PERL-CODE DIR [DIR DIR ..]


OPTIONS

Gneneral options

--name FILE-REGEXP
Search files that match regexp for modification. The regexp is amtched against absolute path name, so don't use ``^Repository$'' to match file exactly, but the leasing forward slash for absolute name: ``/Repository$''

--eval PERL-CODE
Evaluate perl code for each line in the found file. The current line is available at $ARG, so simple substrirutions s/search/substitute/ are the most used ones. However, you can include any valid perl e.g in ``do{ the; code; here }''.

Miscellaneous options

--debug LEVEL
Turn on debug with positive LEVEL number. Zero means no debug.

--help
Print help

--help-html
Print help in HTML format.

--help-man
Print help page in Unix manual page format. You want to feed this output to nroff -man in order to read it.

--test
Run in test mode, do not actually do anything.

--verbose
Print informational messages.

--Version
Print contact and version information


EXAMPLES

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.


TROUBLESHOOTING

<what to check in case of error or weird behavior>


ENVIRONMENT

No environment variables used.


FILES

None.


SEE ALSO

cvs(1) http://www.cvshome.com/


STANDARDS

No standards referenced.


BUGS

None known.


AVAILABILITY

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


SCRIPT CATEGORIES

CPAN/Administrative


PREREQUISITES

None.


COREQUISITES

None.


OSNAMES

any


VERSION

$Id: cvsed.pl,v 1.1 2002/07/26 20:50:01 jaalto Exp $


AUTHOR

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.