summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hein <[email protected]>2021-12-12 20:33:16 -0700
committerraveit65 <[email protected]>2022-03-10 19:44:46 +0100
commit3d732011e34a9b0c593ade0f66261fe7847dceab (patch)
tree5a8db8e7137f8ae33e2d16b52f5c52c43fd0c2ef
parentf84ac66430f9deac0f452d4367e286db012ab89b (diff)
downloadpluma-3d732011e34a9b0c593ade0f66261fe7847dceab.tar.bz2
pluma-3d732011e34a9b0c593ade0f66261fe7847dceab.tar.xz
Increase POSIX compliance and simplify. Remove bashisms and non-POSIX expr(1) usage.
-rw-r--r--plugins/externaltools/data/search-recursive.tool.in22
1 files changed, 1 insertions, 21 deletions
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 |'