/usr/bin/gpiv_fi-keyline is in gpivtools-mpi 0.6.0-3build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #!/usr/bin/perl -w
#
# fi-keyline - Substracts parameters from an arbitrary file and writes them
# to gpivrc. Initially used for substarcting parameters from a
# README doc, containing description of experiments.
#
# Copyright (C) 2002 Gerber van der Graaf
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#------------------------------------------------------------------
$VERSION = q$Id: fi-keyline.pl,v 1.4 2006/03/04 12:37:08 gerber Exp $;
$HELP = "Filters each line that starts with a keyword";
$USAGE = "gpiv_fi-keyline [-h|-help] [-p|-print] [-v|-version]
[-if|input_file] [-of|output_file] keyword
keys:
-h: on-line help
-p: prints process parameters/variables to stdout
-v: prints version
-if: input file
-of: output file
";
#[-n|-none]
#-n: suppresses real execution
#-p: prints process parameters/variables to stdout
#----------------- Command line arguments handling ----------
$opt_h = 0;
# $opt_n = 0;
$opt_p = 0;
$opt_v = 0;
use Getopt::Long;
GetOptions('h|help',
# 'n|none',
'p|print',
'v|version',
'if|input_file=s' => \$infile,
'of|output_file=s' => \$outfile,
);
if ($opt_h) {
print ("$HELP\n");
print ("$USAGE\n");
exit;
}
if ($opt_v) {
print ("$VERSION\n");
exit;
}
if ($#ARGV != 0) {
printf ("\nUsage: $USAGE\n");
exit;
}
$keyword = shift (@ARGV);
#-------------------------------------
if ($infile) {
if ($opt_p) {printf("input file = $infile\n");}
open (STDIN, "$infile") || die 'can\'t open $infile';
}
if ($outfile) {
if ($opt_p) {printf("output file = $outfile\n");}
open (STDOUT, ">$outfile") || die 'can\'t open $outfile';
}
while (<STDIN>) {
chomp;
if ($_ ne "" && (!/^(\#|;)/)) { #skip blank lines, # or ; signs at first col
s/^ *//; #removes eventually leading space
@words = split(/ /, $_); #splitting line $_ up in words
#same as @words = split
if ($words[0] =~ $keyword) {
shift @words;
if ($outfile) {
printf(STDOUT "@words\n");
} else {
printf("@words\n");
}
}
}
}
if ($infile) {close (STDIN) || die 'can\'t close $infile';}
if ($outfile) {close (STDOUT) || die 'can\'t close $infile';}
#
# Thats all folks
#
|