-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.pl
More file actions
executable file
·48 lines (43 loc) · 996 Bytes
/
Copy pathplot.pl
File metadata and controls
executable file
·48 lines (43 loc) · 996 Bytes
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
#!/usr/bin/perl
use strict;
my $dir = shift @ARGV;
my ($type,$subtype) = split(/\./, shift @ARGV);
$subtype = '.' . $subtype if $subtype;
# list files
my @files;
my %fields;
for my $f (`ls $dir/$type*$subtype`) {
chomp $f;
next unless $f =~ /$type(\d+)$subtype$/;
push(@files, $f);
unless (%fields) {
open(I,$f);
while (<I>) {
next unless /^\#/;
my @f = split(/\t/,$_);
for (my $n=1; @f; $n++) {
my $f = shift @f;
$fields{$f} = $n;
#print "$f = $n\n";
}
last;
}
close I;
}
}
#print "#files @files\n";
# get field names
my $var = shift @ARGV;
my $rest = join(' ', @ARGV);
print "set style data lines\nset grid\n";
print "set title \"$dir .. $var\"\n";
if (scalar(@files) > 30) { print "set key off\n"; }
#for my $var (@ARGV) {
my @p;
for my $f (@files) {
my ($lastbit) = $f =~ /\/([^\/]+)$/;
push(@p, "\"$f\" u 1:$fields{$var} $rest t \"$lastbit\"");
}
print "plot " . join(',', @p) . "\n";
#}
#print "pause 60000\n";