tcookwhat: make case-insensitive - recipes - various cooking recipes (HTM) git clone git://src.adamsgaard.dk/recipes (DIR) Log (DIR) Files (DIR) Refs --- (DIR) commit ed66d3ef2d17b66b316934e62b2dde1d7ed8d5ae (DIR) parent fe0fb9ec43255fe98aabb2ca9742a795de30a11b (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Thu, 26 Aug 2021 21:02:56 +0200 cookwhat: make case-insensitive Diffstat: M cookwhat | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- (DIR) diff --git a/cookwhat b/cookwhat t@@ -1,3 +1,13 @@ #!/bin/sh -awksrc="$(printf '/%s/ { print FILENAME }' "$@" | sed 's#,#/\&\&/#g')" -awk -v RS="." "${awksrc}" *.md | sort | uniq +cmd="find . -iname '*.md' -type f" +i=0 +for a in "$@"; do + i=$((i + 1)) + if test "$i" -lt "$#"; then + grepflags="-qiE" + else + grepflags="-liE" + fi + cmd="${cmd} -exec grep ${grepflags} '^- .*${a}' {} \;" +done +eval "$cmd | sed 's,^./,,'"