def do_match(self, s):
"""Matches patterns in a string by using regex."""
if six.PY2:
file_name = raw_input(Fore.RED + "Enter file name?:\n" + Fore.RESET)
pattern = raw_input(Fore.GREEN + "Enter string:\n" + Fore.RESET)
else:
file_name = input(Fore.RED + "Enter file name?:\n" + Fore.RESET)
pattern = input(Fore.GREEN + "Enter string:\n" + Fore.RESET)
file_name = file_name.strip()
if file_name == "":
print("Invalid Filename")
else:
system("grep '" + pattern + "' " + file_name)
评论列表
文章目录