[Durian-svn] [2821] blend grep tool

campbell institute at blender.org
Tue May 4 11:17:05 CEST 2010


Revision: 2821
          https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=2821
Author:   campbell
Date:     2010-05-04 11:17:05 +0200 (Tue, 04 May 2010)
Log Message:
-----------
blend grep tool

Added Paths:
-----------
    pro/scripts/utilities/brep.sh

Added: pro/scripts/utilities/brep.sh
===================================================================
--- pro/scripts/utilities/brep.sh	                        (rev 0)
+++ pro/scripts/utilities/brep.sh	2010-05-04 09:17:05 UTC (rev 2821)
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+OUT=$(mktemp)
+# -B 6 .... before 6
+find . -name "*.blend" -print | grep -v "\.svn" | grep -v "~" | sort | xargs grep -n --color=never -H "$@" >  $OUT 
+
+# Print text with line numbers
+sed = $OUT | sed 'N;s/\n/\t/'
+
+echo -n "enter a number to edit > "
+read -e LINE
+
+if [ "$LINE" == "" ] ; then
+        echo "nothing selected... exiting."
+        exit 0
+fi
+
+LINE=$LINE"p" # 4 -> 4p - for sed
+EDIT=$(cat $OUT | sed -n $LINE)         # file to edit
+
+rm $OUT
+
+FILE=$(echo $EDIT | cut -d":" -f1)
+NUM=$(echo $EDIT | cut -d":" -f2)
+
+# Now edit the file in scite or vim
+scite $FILE -goto:$NUM &
+# vim $FILE +$NUM
+# gedit $FILE +$NUM  &
+


Property changes on: pro/scripts/utilities/brep.sh
___________________________________________________________________
Added: svn:executable
   + *



More information about the Durian-svn mailing list