Random Linux

Linux, video games and web hosting

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.

January 6th, 2011

Posted In: General

Leave a Reply

Your email address will not be published. Required fields are marked *