templates-zabbix-itguys/find_regexp.py

17 lines
553 B
Python

import yaml
import sys
file_path = r'C:\Users\joao.goncalves\Desktop\zabbix-itguys\templates_gold\pfsense_hybrid_snmp_agent\template_pfsense_hybrid_gold.yaml'
try:
with open(file_path, 'r', encoding='utf-8') as f:
lines = f.readlines()
found = False
for i, line in enumerate(lines):
if 'REGEXP' in line:
print(f"Line {i+1}: {line.strip()}")
found = True
if not found:
print("String 'REGEXP' not found in file.")
except Exception as e:
print(f"Error: {e}")