2 # Filename: grml-tips-tags
3 # Purpose: Extract available patterns from grml-tips file
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>, (c) Alexander Wirt <formorer@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 ################################################################################
12 my $grml_tips = '/usr/share/grml-tips/grml_tips';
14 my $result = GetOptions (
15 "tipsfile=s" => \$grml_tips
18 open (my $fh, '<', $grml_tips) or die "Could not open $grml_tips: $!";
22 while (my $line = <$fh>) {
23 next unless $line =~ /^Tags: (.*)$/;
24 push @tags, split(/[, ]+/, $1);
30 @tags = grep { ! $seen{$_} ++ } @tags;
32 open (my $fh, '>', '/usr/share/grml-tips/tags')
33 or die "Could not open '/usr/share/grml-tips/tags' for writing: $!";
34 print $fh join("\n", @tags) . "\n";