You are able to ignore a word with grep using -v and you can ignore the case with -i. So, if you are wanting to check for the database name but not the database user for a WordPress installation, you can use this in the folder that the file is in:
grep -i db wp-config.php| grep -vi user
Which will search for db in wp-config.php, ignoring the case, which is the part before the |, then will leave out the line that says user, which is the part after.
Chris January 6th, 2011
Posted In: General