From jdo-commits-return-2246-apmail-db-jdo-commits-archive=www.apache.org@db.apache.org Fri Jan 11 19:54:13 2008 Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 72050 invoked from network); 11 Jan 2008 19:54:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jan 2008 19:54:13 -0000 Received: (qmail 12106 invoked by uid 500); 11 Jan 2008 19:54:03 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Received: (qmail 12095 invoked by uid 99); 11 Jan 2008 19:54:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jan 2008 11:54:03 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jan 2008 19:53:47 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E37441A9832; Fri, 11 Jan 2008 11:53:52 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r611281 - /db/jdo/bin/behead Date: Fri, 11 Jan 2008 19:53:52 -0000 To: jdo-commits@db.apache.org From: mcaisse@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080111195352.E37441A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mcaisse Date: Fri Jan 11 11:53:51 2008 New Revision: 611281 URL: http://svn.apache.org/viewvc?rev=611281&view=rev Log: Script for removing boilerplate text from the head of annotation and enum files. Added: db/jdo/bin/behead (with props) Added: db/jdo/bin/behead URL: http://svn.apache.org/viewvc/db/jdo/bin/behead?rev=611281&view=auto ============================================================================== --- db/jdo/bin/behead (added) +++ db/jdo/bin/behead Fri Jan 11 11:53:51 2008 @@ -0,0 +1,42 @@ +#!/bin/sh +# Read .java files in source directory, +# copying lines from the first line matching +# the start pattern to the end of the file +# to a file of the same name in the target directory +# +# Designed to be used to remove license header and imports from +# annotation and enum files in the JDO api project for import +# into the FrameMaker specification +# +# Tested on cygwin and Mac +# +USAGE="behead " +if [ $# -ne 2 ] + then + echo $USAGE + exit -1 +fi + +SRCDIR=$1 +TARGETDIR=$2 + +STARTPATTERN="^@" +ENUMSTARTPATTERN="public enum" + +for FILE in `ls $SRCDIR/*.java` +do + ROOT=`basename $FILE .java` + OUTFILE=${TARGETDIR}/${ROOT}.txt + if [ `grep -c "public enum" $FILE` -gt 0 ] + then + STARTINDEX=`grep --max-count=1 -n "${ENUMSTARTPATTERN}" $FILE | cut -d: -f1 ` + else + STARTINDEX=`grep --max-count=1 -n $STARTPATTERN $FILE | cut -d: -f1 ` + fi + #echo $STARTINDEX + ENDINDEX=`wc -l $FILE | sed -e "s/^ *//" | cut -f1 -d" " ` + #echo $ENDINDEX + NUMLINES=`expr $ENDINDEX - $STARTINDEX + 1` + echo Copying ${NUMLINES} lines from $FILE to $OUTFILE + tail -n ${NUMLINES} $FILE > ${OUTFILE} +done Propchange: db/jdo/bin/behead ------------------------------------------------------------------------------ svn:executable = *