1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

Added search utility

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2021-02-07 16:13:30 +01:00
parent 3f61d130f9
commit f5b7b183d2

16
bin/search Executable file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
filter="$1"; shift;
grep=""
for q in "$@" ; do
list=-l
if [ "TEST${q:0:1}" = "TEST-" ]; then
list=-L
q=${q:1}
fi
grep="$grep | xargs -0 -n10 grep --null $list -E \"$q\""
done;
eval "find -iname \"$filter\" -print0 $grep | tr '\0' '\n'"