Received: from spf5.us4.outblaze.com (spf5.us4.outblaze.com [205.158.62.27]) by sdf.lonestar.org (8.12.10/8.12.10) with ESMTP id iAEGno9n006995 for ; Sun, 14 Nov 2004 16:49:51 GMT Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by spf5.us4.outblaze.com (Postfix) with ESMTP id E7D7C7756D for ; Sun, 14 Nov 2004 16:49:53 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CTNiE-0002aN-5J for migo@homemail.com; Sun, 14 Nov 2004 11:58:50 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CTNhu-0002aI-OG for gnu-arch-users@gnu.org; Sun, 14 Nov 2004 11:58:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CTNhu-0002a6-Ak for gnu-arch-users@gnu.org; Sun, 14 Nov 2004 11:58:30 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CTNhu-0002a3-6o for gnu-arch-users@gnu.org; Sun, 14 Nov 2004 11:58:30 -0500 Received: from [204.127.198.35] (helo=rwcrmhc11.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CTNYr-00028P-JE for gnu-arch-users@gnu.org; Sun, 14 Nov 2004 11:49:09 -0500 Received: from flacy.home.flacy (c-24-0-115-106.client.comcast.net[24.0.115.106]) by comcast.net (rwcrmhc11) with ESMTP id <200411141649080130064ju3e>; Sun, 14 Nov 2004 16:49:08 +0000 Received: from flacy.home.flacy (IDENT:1000@localhost [127.0.0.1]) by flacy.home.flacy (8.12.10/8.12.8) with ESMTP id iAEGn2me002177 for ; Sun, 14 Nov 2004 10:49:07 -0600 X-Mailer: emacs 21.3.2 (via feedmail 8 I) To: arch Subject: Re: [Gnu-arch-users] new version hook script examples References: <1096079213.3761.169.camel@whiskas.cashpoolcomps.com> <20040925174731.GB26602@stig.vm.bytemark.co.uk> <1096157610.25824.3.camel@whiskas.cashpoolcomps.com> <20040926002248.GA19343@suffields.me.uk> <1096158785.25824.14.camel@whiskas.cashpoolcomps.com> <1100057346.4185.135.camel@localhost.localdomain> From: "Mark A. Flacy" Date: 14 Nov 2004 10:48:59 -0600 In-Reply-To: <1100057346.4185.135.camel@localhost.localdomain> Message-ID: <87sm7cgyv8.fsf@flacy.home.flacy> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: gnu-arch-users@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: a discussion list for all things arch-ish List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: gnu-arch-users-bounces+migo=homemail.com@gnu.org Errors-To: gnu-arch-users-bounces+migo=homemail.com@gnu.org Status: RO Content-Length: 2643 Lines: 102 >>>>> "Zenaan" == Zenaan Harkness writes: Zenaan> Zenaan> On Sun, 2004-09-26 at 10:33, Zenaan Harkness wrote: Zenaan> Zenaan> BTW, does anyone know/ use an alternative to perl -i for in-place Zenaan> munging? I guess I should learn how to chain multiple lines such as the Zenaan> following into one, since firing up perl for each line seems rather Zenaan> heavy weight. Well, use ed. Read the file in, do your search and replace, and write the file out. An example would be this slightly modified repackage script that I wrote... #! /bin/bash TMP=${TMPDIR:-/tmp}/munge.sh.$$ trap "rm $TMP* 2>/dev/null" 0 # # All of FROML is passed to grep to find any matches # Treat FROML and TOL as two matching lists; the first item in # FROML will be replaced with the first item in TOL and so on. # # The lists are processed in reverse order. # # # Amazing what you can do with this stuff # # normally called as.... # find . -type d | xargs -n1 munge.sh # # And yes, the find loop could be inside the script. FROML=( "com\.xxx\.ims\.foundation\.lang\.Class1" "com\.xxx\.ims\.foundation\.lang\.Class2" "com\.xxx\.ims\.foundation\.lang\.Class3" ) TOL=( "com\.xxx\.ims\.foundation\.runtime\.Class1" "com\.xxx\.ims\.foundation\.system\.Class2" "com\.xxx\.ims\.foundation\.netfx\.Class3" ) EDSCR=$TMP.edscr echo "f" > $EDSCR for ((lim=${#FROML[*]} ; lim ; lim--)); do echo "g@"${FROML[lim-1]}"@s@"${FROML[lim-1]}"@"${TOL[lim-1]}"@g" >> $EDSCR done echo "wq" >> $EDSCR #echo "--------------" #cat $EDSCR #echo "--------------" #echo echo " " >> $EDSCR for i in "$1"/*; do if [ -f "$i" ]; then grep -q -f $TMP "$i" && ( echo "Matches in $i" chmod +w $i ed $i <$EDSCR echo "$i complete" ) fi done Zenaan> Zenaan> perl -pi -e "s#SUB_WEB_HOST#$SUB_WEB_HOST#g;" $SED_FILES Zenaan> perl -pi -e "s#SUB_server.host#$SUB_server_host#g;" $SED_FILES Zenaan> ... Zenaan> Zenaan> ?? Zenaan> Zenaan> tia Zenaan> zen Zenaan> Zenaan> Zenaan> _______________________________________________ Zenaan> Gnu-arch-users mailing list Zenaan> Gnu-arch-users@gnu.org Zenaan> http://lists.gnu.org/mailman/listinfo/gnu-arch-users Zenaan> Zenaan> GNU arch home page: Zenaan> http://savannah.gnu.org/projects/gnu-arch/ Zenaan> -- Mark A. Flacy Any opinions expressed above are my own. Any facts expressed above are, ummm, facts. _______________________________________________ Gnu-arch-users mailing list Gnu-arch-users@gnu.org http://lists.gnu.org/mailman/listinfo/gnu-arch-users GNU arch home page: http://savannah.gnu.org/projects/gnu-arch/