- my $header = "Grml Tip Number $tips_found\n";
- my $line = "-" x ( length($header) - 1 ) . "\n\n";
-
- push @tips, $header . $line . $tip . "\n";
- $tip = '';
- }
- else {
+ $tips_found++;
+ if ($tagsonly) {
+ #extract tags from tip
+ my ($tag) = $tip =~ /^Tags: (.*)$/m;
+ my @tags = split(/[, ]+/, $tag);
+ if (grep(/^$pattern$/i, @tags) ) {
+ push @tips, $header . $line . $tip . "\n";
+ }