Find all files ending with ".conf" in the current directory, search for the string "localhost" in each file, and delete any files that contain the string.
find ~ -name "*.conf" -exec grep -lq "localhost" {} \; -exec rm -f {} \;