I have a huge text file containing 384 firewall rules written up as this:
Rule 1 LAN -> LAN Allow Service Any -> SSH Management (Enabled)
IP: Any -> All X0 Management IP Iface: Any (ffffffff) -> Any (ffffffff)
Policy Name:
UUID: bfc907b9-b13b-05eb-0700-c0eae481e2c2
Instance: 13819585425686857195
Logging: Enabled Management: Enabled
Allow Fragmented Packets: Enabled Packet Monitor: Disabled
Flow Reporting: Disabled
Auto Rule: Disabled
Users: Included: All, Excluded: None
Schedule: Always on (on)
Comment: Auto-added management rule
Timeout: TCP:5 minutes, UDP:30 seconds
IP Version: IPv4
Properties: 0xffeffd, Priority Type: Manual
Max Connections: 100% of maximum connections
Connections: 1
Src IP connection limit: 128 (off)
Dst IP connection limit: 128 (off)
Geo IP Block: 0
Per Policy Geo IP Block: 0
Per Policy Geo IP Bitmap:
Per Policy Block Unknown: 0
Botnet Block: 0
Bypass DPI: No
Bypass DPI-SSL Client: No
Bypass DPI-SSL Server: No
Qos Marking DSCP Action: Preserve
Qos Marking 802.1p Action: None
Egress BWM: Disabled
Ingress BWM: Disabled
Tracking Bandwidth Usage: Disabled
Bytes, Packets: Rx: 2640, 60 Tx: 5612, 122
Usage : 389
Time Created: 07/05/2019 11:05:11.000
Time Updated: 12/04/2019 21:59:23.000
Time Config Updated: 07/05/2019 11:05:11.000
Time Last Hit: 02/17/2020 09:08:27.000
And I need only the first two lines of each rule (there 750 of these rules).
Rule 1 LAN -> LAN Allow Service Any -> SSH Management (Enabled)
IP: Any -> All X0 Management IP Iface: Any (ffffffff) -> Any (ffffffff)
I know I could use regex or macros to do something like this but I don’t know how to tackle that issue, especially how to match with a regex anything after Rule [number], including the second line, without matching anything else.
I also have no idea what functions to use in the macro to then export al matches to a new file, preferrably a libreoffce calc file, from which I could then keep formatting them with simpler macros and regex until I have something workable.
any help or direction would be highly appreciated, thanks!