Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AWK script to perform cvs update

Status
Not open for further replies.

fabienc

Programmer
Mar 5, 2007
3
AU
Hi!

I am looking for an AWK script that would take a directory as input and execute "cvs update" on each files found in its sub-directories avoiding all sub-directories called "CVS".

I know I can use some tools like TortoiseCVS to do this, the problem is that I am working on some files/directories which are extracted from a main repositry and I dont want CVS to add all the files I have not modified.

Thanks a lot!

 

Once I developped a script for SCCS (which is similar to CVS) to add/update files resident in the current directory.

The main "loop" would check if file exists in the SCCS directory; if not it would 'add' the file, else it would 'update' the file -- something kinda like this code snippet:
Code:
cd /target/directory
for f in `ls -p`
do
  s="${f%%*/}"
  if [ ! -z "$s" ]; then
    sfx=${s##*.}
    #echo "File is: $s Type: $sfx"
    if [[ "$s" != "$sfx" ]]; then
      if [[ ! -f SCCS/s.$s ]]; then
        case $sfx in
           sh) addsccs $s $REVN;;
          csh) addsccs $s $REVN;;
          ksh) addsccs $s $REVN;;
          pls) addsccs $s $REVN;;
           pl) addsccs $s $REVN;;
          sql) addsccs $s $REVN;;
          trg) addsccs $s $REVN;;
          txt) addsccs $s $REVN;;
            *) ls -alp $s;;
        esac
      else
        updsccs $s
      fi
    fi
  fi
done
[3eyes]



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Thanks, I actually found the solution myself using the simple unix command not awk:

Code:
find -name "CVS" -prune -o -type f -exec  cvs update {} \;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top