Search for specific string using shell script

I have a set of log files and I need to find tables from a specific database being used by searching them in log files. The search keyword should start with 'database.' and should be able to grep/parse all table names with preceding database name. Can anyone advise on how this can be achieved using shell script.

Thanks


Solution 1:

This is very easy:

grep "database" *              : this shows the filename + the entire line
grep -l "database" *           : this shows only the filename
grep -o "database [a-z]*" *    : this shows the filename + the database name
grep -h -o "database [a-z]*" * : this shows the database name