my_bashrc/bashrc.d/tgrep_function

8 lines
212 B
Bash
Executable file

#!/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}"
}