def do_show(self, line):
        if not line:
            raise ShellException("Could not understand grep request, " +
                                 "see 'help grep'")

        mods = self.parseModifiers(line)
        line = mods['line']

        tline = line[:]
        search_strs = []
        ignore_str = ""
        start_tm = "head"
        duration = ""
        sources = []
        unique = False
        is_and = False
        is_casesensitive = True
        reading_search_strings = False
        search_string_read = False
        while tline:
            search_string_read = False
            word = tline.pop(0)
            if word == '-s':
                try:
                    search_strs.append(strip_string(tline.pop(0)))
                    reading_search_strings = True
                    search_string_read = True
                except:
                    search_strs = []
            elif word == '-a':
                is_and = True
            elif word == '-v':
                ignore_str = tline.pop(0)
                ignore_str = strip_string(ignore_str)
            elif word == '-u':
                unique = True
            elif word == '-i':
                is_casesensitive = False
            elif word == '-f' and not self.grep_cluster:
                start_tm = tline.pop(0)
                start_tm = strip_string(start_tm)
            elif word == '-d' and not self.grep_cluster:
                duration = tline.pop(0)
                duration = strip_string(duration)
            elif word == '-n':
                try:
                    sources = [
                        int(i) for i in strip_string(
                            tline.pop(0)).split(",")]
                except:
                    sources = []
            elif reading_search_strings:
                try:
                    search_strs.append(strip_string(word))
                except:
                    pass
                search_string_read = True
            else:
                raise ShellException(
                    "Do not understand '%s' in '%s'" % (word, " ".join(line)))
            if not search_string_read:
                reading_search_strings = False

        if search_strs:
            files = self.logger.get_files_by_index(
                self.grep_cluster,
                sources)
            for timestamp in sorted(files.keys()):
                grepRes = self.logger.grep(
                    files[timestamp],
                    search_strs,
                    ignore_str,
                    unique,
                    self.grep_cluster,
                    start_tm,
                    duration,
                    is_and, is_casesensitive)
                merged_res = ""
                for key in sorted(grepRes.keys()):
                    merged_res += grepRes[key]
                    merged_res += "\n"
                self.view.infoString(timestamp, merged_res)
dataset/ETHPy150Open aerospike/aerospike-admin/lib/logcontroller.py/GrepFile.do_show/original