------------------cat SortData.py
#!/bin/python
# -*- coding: utf-8 -*-
import codecs
import json
import re
import argparse
import os
#----------parameter sort
def train_options():
parser = argparse.ArgumentParser()
parser.add_argument("--station", default='HamiltonCT', help='test station')
parser.add_argument("--file", default='tmp.log', help='test station')
opt = parser.parse_args()
return opt
opt = train_options()
#print(opt.station)
#print(opt.file)
#-----------open add read the log file
fo = open(opt.file, "r+")
buff_file = fo.read()
#print(buff_file)
#pattern = '(\w+)\s*:\s*flags'
#pattern='(\w+)item(\w+)False(\w+)'
pattern="(.*)Item(.*)False(.*)"
result = re.findall(pattern, buff_file)
if result:
# print(pattern)
# print(result)
------shell
[root@K2-DHCP 1001-1023-P4]# cat /tmp/EM3AD000EK40008.log|grep False|grep -i item
[2023-10-17 18:48:03] [ INFO] -- ┗━━━━━━━━━ Complete TestItem "FPGAPowerTest" Return result "False" ━━━━━━━━━┛