my_bashrc/bashrc.d/tgrep_function

9 lines
212 B
Text
Raw Normal View History

2024-02-24 17:34:01 +01:00
#!/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}"
}