From 5c50bc3b92df1cff7ac0061fcbe0979c6ee61502 Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 6 May 2020 05:56:00 +0530 Subject: Use \t instead of \s & make the output neater We replace \t with ": " before printing to make the output neater. Also \t is now used to match against instead of /s because it's what defined in wtf manual. Talking about OpenBSD 6.6 wtf manual here, I assume it will be the same for original wtf. --- pictor.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pictor.pl b/pictor.pl index fc24968..de255ef 100755 --- a/pictor.pl +++ b/pictor.pl @@ -53,9 +53,11 @@ foreach my $fn (@files) { while (my $line = readline $fh) { # \Q is quotemeta, \E terminates it because otherwise it would - # mess with \s. This regex matches when $line starts with - # "$term\s", \s being any kind of whitespace. - print $line if ($line =~ /^\Q${term}\E\s/i); + # mess with \t. This regex matches when $line starts with + # "$term\t". We replace \t with ": " before printing to make + # the input neat. + print $line =~ s/\t/: /r if + ($line =~ /^\Q${term}\E\t/i); } } -- cgit 1.4.1-2-gfad0