Hot answers tagged

2

Create a function: mygrep() { find /path -type f -exec grep -irl "$1" {} +; } mygrep waldo Actually, why do you even need find? mygrep() { grep -irl "$1" /path; }


1

You need use RegEx that find lines containing certain words: Matches a complete line of text that contains any of the words "one", "two" or "three": greedy: ^.*\b(one|two|three)\b.*$ lazy: ^.*?\b(one|two|three)\b.*$ Matches a complete line of text that contains all of the words "one", "two" and "three": ^(?=.*?\bone\b)(?=.*?\btwo\b)(?=.*?\bthree\b).*$


1

sed, awk, others, many could do this. tr one: tr -d '"' < file The -d option is to delete things. And tr doesn't just read files, so use < to feed file content to it. It's same as: cat file | tr -d '"'



Only top voted, non community-wiki answers of a minimum length are eligible