projects
/
grml-tips.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix small typo in tag
[grml-tips.git]
/
grml-tips-tags
diff --git
a/grml-tips-tags
b/grml-tips-tags
index
c1cdd0d
..
a7a4d49
100755
(executable)
--- a/
grml-tips-tags
+++ b/
grml-tips-tags
@@
-7,8
+7,14
@@
################################################################################
use strict;
################################################################################
use strict;
+use Getopt::Long;
my $grml_tips = '/usr/share/grml-tips/grml_tips';
my $grml_tips = '/usr/share/grml-tips/grml_tips';
+
+my $result = GetOptions (
+ "tipsfile=s" => \$grml_tips
+);
+
open (my $fh, '<', $grml_tips) or die "Could not open $grml_tips: $!";
my @tags;
open (my $fh, '<', $grml_tips) or die "Could not open $grml_tips: $!";
my @tags;
@@
-18,8
+24,12
@@
while (my $line = <$fh>) {
push @tags, split(/[, ]+/, $1);
}
push @tags, split(/[, ]+/, $1);
}
+close ($fh);
#make tags unique
my %seen = ();
@tags = grep { ! $seen{$_} ++ } @tags;
#make tags unique
my %seen = ();
@tags = grep { ! $seen{$_} ++ } @tags;
-print join("\n", @tags) . "\n";
+open (my $fh, '>', '/usr/share/grml-tips/tags')
+ or die "Could not open '/usr/share/grml-tips/tags' for writing: $!";
+print $fh join("\n", @tags) . "\n";
+close($fh)