From a0382fb8ee619f123c1ebda9fdca7e9387c13437 Mon Sep 17 00:00:00 2001 From: Alexander Wirt Date: Mon, 13 Jun 2011 11:14:15 +0200 Subject: [PATCH] Add a nice header for every tip --- grml-tips | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/grml-tips b/grml-tips index 161bc9d..dfa7bd9 100755 --- a/grml-tips +++ b/grml-tips @@ -87,13 +87,19 @@ if (! open (my $fh, '<', "$grml_tips")) { } else { my $tip = ''; + my $tips_found = 0; while (my $line = <$fh>) { if ($line !~ /^-- $/) { $tip .= $line; } else { + $tips_found++; if ( $tip =~ /$pattern/mi ) { - $tip .= $line; - push @tips, $tip; + #$tip .= $line; + + my $header = "Grml Tip Number $tips_found\n"; + my $line = "-" x (length($header) -1 ) . "\n\n"; + + push @tips, $header . $line . $tip . "\n"; $tip = ''; } else { $tip = ''; -- 2.1.4