search for text - currently this looks in all folders in the
    root of AIKIF but that also contains binaries so will need to 
    use the agent_filelist.py to specify the list of folders.
    
    NOTE - this needs to use indexes rather than full search each time

def search_aikif(txt, formatHTML=True):
    """
    search for text - currently this looks in all folders in the
    root of AIKIF but that also contains binaries so will need to 
    use the agent_filelist.py to specify the list of folders.
    
    NOTE - this needs to use indexes rather than full search each time
    """
    results = []
    num_found = 0
    import aikif.lib.cls_filelist as mod_fl
    my_files = mod_fl.FileList([aikif_folder ], ['*.*'], ['*.pyc'])
    files = my_files.get_list()
    for f in files:
        try:
            num_found = 0
            with open(f, 'r') as cur:
                line_num = 0
                for line in cur:
                    line_num += 1
                    if txt in line:
                        num_found += 1
                        if formatHTML is True:
                            results.append(format_result(line, line_num, txt))
                        else:
                            results.append([f, line, line_num, txt])
            if num_found > 0:
                if formatHTML is True:
                    results.append('<h3>' + f + ' = ' + str(num_found) + ' results</h3>')
                else:    
                    print(f + ' = ' + str(num_found) + '')
        except Exception:
            results.append('problem with file ' + f)
    if len(results) == 0:
        results.append("No results")
    return results