Wouldn't sth like
grep -r --include="$1" -n -i "$2"
do the same thing?
@Wolf480pl Kind of, but it lists the paths before each line, and I often deal with long paths.
Welcome to your niu world ! We are a cute and loving international community Ｏ(≧▽≦)Ｏ !