From: Sean A. <ah...@or...> - 2006-05-16 16:29:13
|
I haven't tried it, but wouldn't this work as a one-liner? % find . -name Root -print | perl -pi.bak -e 's/cvs/chromium.cvs/g' -Sean -- Sean Ahern Oak Ridge National Laboratory On May 16, 2006, at 11:07 AM, Robert Ellison wrote: >> If you want to update all the CVS/Root files in your current CVS >> tree, replace the old hostname: >> cvs.sourceforge.net >> with the new one: >> chromium.cvs.sourceforge.net >> Maybe someone handy with shells scripts can post a 'find/sed' >> command to do this. > $ cd <chromiumDirectory> > $ cvsmv cvs.sourceforge.net chromium.cvs.sourceforge.net > > Bob Ellison > Self-proclaimed Script Meister > Tungsten Graphics, Inc. > #!/bin/bash > prog=${0##*/} > > # > # Things to do if you catch an interrupt > # > trap "rm -f /tmp/$prog$$*" 0 > trap "rm -f /tmp/$prog$$*; exit 2" 1 2 3 15 > > # > # Set variables to default values > # > verbose=no > directory=. > tmpFileList=/tmp/$prog$$A > tmpEditedFile=/tmp/$prog$$B > > # > # Parse command-line options > # > > options=":hxd:" > while getopts "$options" arg > do > case "$arg" in > h) { > echo "Usage: $prog [-${options#:}] /old-cvsroot /new-cvsroot" > echo "Change all references in CVS/Root files from the old CVS > root to the new one" > echo "-h gives help" > echo "-x for debug" > echo "-d specifies directory [$directory]" > } 1>&2 > exit 1 > ;; > x) verbose=yes ; set -x ;; > :) echo "$prog: $OPTARG requires an argument. Use -h for help." > 1>&2 > exit 2 > ;; > *) { > echo "$prog: unknown option '$OPTARG'. Use -h for help." > } 1>&2 > exit 2 > esac > done > shift $(($OPTIND - 1)) > > if [ $# -ne 2 ]; then > echo "$prog: need exactly 2 arguments. Use -h for help." 1>&2 > exit 2 > fi > > # Get all the files that refer to the old CVS root > find $directory -path '*CVS/Root' | xargs grep -l $1 > $tmpFileList > > # Edit them one at a time. > cat $tmpFileList | while read file; do > sed -e "s%$1%$2%g" < $file > $tmpEditedFile > mv $tmpEditedFile $file > done > > > exit 0 |