Created
August 14, 2023 17:40
-
-
Save robinkaty/7276b16f2774fe8586e72d82f12f622a to your computer and use it in GitHub Desktop.
Check Timemachine Output for "0 bytes/sec" and insert error warning into stream/pipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my $special_string = "0 bytes/sec"; | |
sub process_text_pipe { | |
my @output; | |
while (<>) { | |
my $line = $_; | |
chomp $line; | |
if ($line =~ /$special_string/) { | |
$line .= "\n\n !!!! ERROR ERROR ERROR ERROR !!!!\n"; | |
} | |
push @output, $line; | |
} | |
return @output; | |
} | |
my @processed_output = process_text_pipe(); | |
foreach my $line (@processed_output) { | |
print "$line\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment