But had been falling short on how to specify each specific part. Out of all the log files I would ideally love to extract the following snippets - System, Box, ByteIn, Bytesout, Description From the log example below the data would be:while (<IN>) { if (m/Server*Example/ig) { print OUT $_, "\n"; print $_; } }
Once the file data had been extracted from the .txt file --> output to a new CSV format file so I could read it into spreadsheets, example - System Box ByteIn Byteout Description:System : system001-server Box : HW a2b 1234Mb 123.4, address is 0012.d345.1234 (abc 0012.d123 +.4567) ByteIn : 3385567095904 Byteout : 5816943852464 Description : example_system_server_example
This would be the ideal outcome, any help in how to do this properly would be_VERY_ much appreciated. Cas.system001-server,HW a2b 1234Mb 123.4, address is 0012.d345.1234 (abc 0 +012.d123.4567),3385567095904,5816943852464,example_system_server_exam +ple
log example (from .txt file): == system001-server GigabitEthernet7/1 is up, line protocol is up (connected) HW a2b 1234Mb 123.4, address is 0012.d345.1234 (abc 0012.d123.4567) Description: example_system_server_example MTU 1234 bytes, BW 12345678 Kbit, DLY 10 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full-duplex, 1000Mb/s, media type is 10/100/1000BaseT input flow-control is off, output flow-control is on Input queue: 0/2000/249/0 (size/max/drops/flushes); Total output drops +: 9725919 5 minute input rate 1918000 bits/sec, 166 packets/sec 5 minute output rate 659000 bits/sec, 154 packets/sec 3448177417 packets input, 3385567095904 bytes, 0 no buffer Received 8858 broadcasts (285 multicasts) 4942780696 packets output, 5816943852464 bytes, 0 underrun GigabitEthernet7/2 is up, line protocol is up (connected) HW a2b......... ==
In reply to Perl: Extracting specific text from a .txt file and outputting into a new format by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |