Results 1 to 4 of 4
Hi,
I'd like to mix 2 commands but I don't know how to do this...
$> locate mysql
-> to find all files matching with "mysql"
and
$> cat (of ...
- 04-06-2005 #1Just Joined!
- Join Date
- Mar 2005
- Posts
- 12
cat of pre-selected files
Hi,
I'd like to mix 2 commands but I don't know how to do this...
$> locate mysql
-> to find all files matching with "mysql"
and
$> cat (of the files above) | grep datadir
-> to show the files that contain "datadir" among the files above
It might be a pipe but I don't know where to put it...
Thanks
- 04-06-2005 #2Linux Guru
- Join Date
- Mar 2003
- Location
- Wisconsin
- Posts
- 1,907
How about:
JeremyCode:locate mysql | grep datadir
Registered Linux user #346571
"All The Dude ever wanted was his rug back" - The Dude
- 04-06-2005 #3Just Joined!
- Join Date
- Mar 2005
- Posts
- 12
no, what I would like to do is :
to find all files which file path or name contain "mysql" and file contain the "datadir" string inside.
N.B: You gave me the way to find all files which contain "mysql" and "datadir" in their file path or name.
- 04-07-2005 #4Just Joined!
- Join Date
- Sep 2004
- Posts
- 12
The "-H" option is to specify the file name you are searching insideCode:for i in $(locate mysql) ; do grep -H "datadir" ; done


Reply With Quote