@@ -0,0 +1,1937 @@
+# Does a case-insensitive search for a string in the help texts for symbols and%0A# choices and the titles of menus and comments. Prints the matching items%0A# together with their locations and the matching text. Used like%0A#%0A#  $ make %5BARCH=%3Carch%3E%5D scriptconfig SCRIPT=Kconfiglib/examples/help_grep.py SCRIPT_ARG=%3Csearch text%3E%0A%0Aimport kconfiglib%0Aimport sys%0A%0Aif len(sys.argv) %3C 3:%0A    print 'Pass search string with SCRIPT_ARG=%22search string%22'%0A    sys.exit(1)%0Asearch_string = sys.argv%5B2%5D.lower()%0A%0Aconf = kconfiglib.Config(sys.argv%5B1%5D)%0A%0Afor item in conf.get_symbols() +%5C%0A            conf.get_choices() + conf.get_menus() + conf.get_comments():%0A    if item.is_symbol() or item.is_choice():%0A        text = item.get_help()%0A    elif item.is_menu():%0A        text = item.get_title()%0A    else:%0A        # Comment%0A        text = item.get_text()%0A%0A    # Case-insensitive search%0A    if text is not None and search_string in text.lower():%0A        if item.is_symbol() or item.is_choice():%0A            # Indent lines in help text. (There might be a nicer way. :)%0A            text = %22%5Cn%22.join(%5B%22  %22 + s for s in text.splitlines()%5D)%0A%0A            # Don't worry about symbols/choices defined in multiple locations to%0A            # keep things simple%0A            fname, linenr = item.get_def_locations()%5B0%5D%0A            if item.is_symbol():%0A                print %22config %7B0%7D at %7B1%7D:%7B2%7D:%5Cn%7B3%7D%22.%5C%0A                      format(item.get_name(), fname, linenr, text)%0A            elif item.is_choice():%0A                print %22choice at %7B0%7D:%7B1%7D:%5Cn%7B2%7D%22.%5C%0A                      format(fname, linenr, text)%0A%0A        else:%0A            # Menu or comment%0A            fname, linenr = item.get_location()%0A            if item.is_menu():%0A                print 'menu %22%7B0%7D%22 at %7B1%7D:%7B2%7D'.%5C%0A                      format(text, fname, linenr)%0A            else:%0A                # Comment%0A                print 'comment %22%7B0%7D%22 at %7B1%7D:%7B2%7D'.%5C%0A                      format(text, fname, linenr)%0A

Add a grep'ing example.