From 3d732011e34a9b0c593ade0f66261fe7847dceab Mon Sep 17 00:00:00 2001 From: John Hein Date: Sun, 12 Dec 2021 20:33:16 -0700 Subject: Increase POSIX compliance and simplify. Remove bashisms and non-POSIX expr(1) usage. --- .../externaltools/data/search-recursive.tool.in | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'plugins') diff --git a/plugins/externaltools/data/search-recursive.tool.in b/plugins/externaltools/data/search-recursive.tool.in index fcb6d169..213a4684 100644 --- a/plugins/externaltools/data/search-recursive.tool.in +++ b/plugins/externaltools/data/search-recursive.tool.in @@ -17,24 +17,4 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. SEARCHTEXT=`zenity --entry --title="Search text on files" --text="Text to search"` - -if [ ! "${#SEARCHTEXT}" = 0 ]; then - - OIFS=$IFS; IFS=$'\n' # Backup and set new IFS - - for LINE in `grep -nHIirF -- "$SEARCHTEXT" ./`; do - primer_indice=`expr index "$LINE" :` - tmp=${LINE:$primer_indice} - segundo_indice=`expr index "$tmp" :` - linea_codigo=${tmp:$segundo_indice} - - # lugar donde está la palabra - posicion=`expr index "$tmp" "$SEARCHTEXT"` - - linea_archivo=${LINE:0:$primer_indice + $segundo_indice - 1} - - echo "${linea_archivo}: ${linea_codigo}" - done - - IFS=$OIFS # Restore IFS -fi +grep -nHIirF -- "$SEARCHTEXT" ./ | sed 's|\([^:]*:[^:]*:\)|\1 |' -- cgit v1.2.1