'''
python
import os
import re
# 获取当前目录下的所有文件
sysname_pattern=r"sysname (.*)"
interface_pattern=r"hrp (interface .*) remote .*"
file_list = os.listdir('.')
# 遍历文件列表
for file_name in file_list:
if file_name.endswith(".log"):
with open(file_name, 'r') as f:
for line in f:
sysname=re.findall(sysname_pattern,line)
if sysname != []:
break
for line in f:
hrp_interface=re.findall(interface_pattern,line)
if hrp_interface != []:
break
new_file_name = sysname[0] + ".txt"
with open(new_file_name, 'w') as new_f:
new_f.write("%s\n" % hrp_interface[0])
new_f.write(" service-manage enable\n")
new_f.write(" service-manage ssh permit\n")
'''