From 689d81e68f4ba86f21c898d5fc74f115756aa7a6 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Sat, 24 Feb 2024 18:34:01 +0200 Subject: [PATCH] Add tgrep function --- bashrc.d/tgrep_function | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 bashrc.d/tgrep_function diff --git a/bashrc.d/tgrep_function b/bashrc.d/tgrep_function new file mode 100755 index 0000000..e0ee6cf --- /dev/null +++ b/bashrc.d/tgrep_function @@ -0,0 +1,8 @@ +#!/bin/bash +function tgrep() { + if [ ${#} -ne 2 ]; then + echo "First argument is a file, second argument a regexp to filter it while tailing" + exit 1 + fi + tail -f "${1}" | grep -E "${2}" +}