Things that are in my .zshrc but should be the default in every POSIX-compliant shell ever: fsgrep "*.h" "string"
Searches recursively through all subdirectories for files matching the pattern, then searches the files for a given string and reports where it found it and in which lines.

@lynne
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.

@Wolf480pl Loses highlighting, and less is just less useful unless you're 100% committed to terminal-only use. And still keeps the paths up front.

Follow

@lynne
--color=always |less -RS
but yeah yours is better

Sign in to participate in the conversation
niu.moe

Welcome to your niu world ! We are a cute and loving international community O(≧▽≦)O !