use strict;
my $str = 'Thu Feb 11 15:01:37 CET 2021
/dev/mapper/vgdata-euramis_u000 ==> /ec/prod/server/euramis/u000
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00383015 s, 134 kB/s
Command being timed: "dd if=/dev/zero of=/ec/prod/server/euramis/u000/TstPerf/test_512_1 bs=512 count=1 oflag=dsync"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 25%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 812
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 252
Voluntary context switches: 4
Involuntary context switches: 1
Swaps: 0
File system inputs: 0
File system outputs: 8
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
Thu Feb 11 16:02:17 CET 2021
/dev/mapper/vgdata-euramis_u000 ==> /ec/prod/server/euramis/u000
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00275458 s, 186 kB/s
Command being timed: "dd if=/dev/zero of=/ec/prod/server/euramis/u000/TstPerf/test_512_1 bs=512 count=1 oflag=dsync"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 33%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 816
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 253
Voluntary context switches: 4
Involuntary context switches: 1
Swaps: 0
File system inputs: 0
File system outputs: 8
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
Thu Feb 11 17:02:26 CET 2021
/dev/mapper/vgdata-euramis_u000 ==> /ec/prod/server/euramis/u000
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00323523 s, 158 kB/s
Command being timed: "dd if=/dev/zero of=/ec/prod/server/euramis/u000/TstPerf/test_512_1 bs=512 count=1 oflag=dsync"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 25%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 820
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 252
Voluntary context switches: 4
Involuntary context switches: 1
Swaps: 0
File system inputs: 0
File system outputs: 8
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
';
my $regex = qr/([A-Z][a-z]{2} [A-Z][a-z]{2} \d{2} \d{2}:\d{2}:\d{2} CET \d{4})\n(/dev.*?) ==> (.*?)\n.*?\n(\d*) bytes .*? copied, (.*?) s, (.*?) (.*?s\n)(.*?)Exit status: (\d*)\n/smp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html