Use command grep and locate

Jhonathan picture Jhonathan · Sep 10, 2012 · Viewed 8.7k times · Source

How I can make the grep command locate certain words in the files specified by the routes found by the locate command?

locate my.cnf | grep user

(I want that grep command search the word "user" on the files found for locate command)

Answer

cha0site picture cha0site · Sep 10, 2012

Try:

locate my.cnf | xargs grep user