-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathobo-cat.pl
More file actions
executable file
·73 lines (64 loc) · 1.18 KB
/
obo-cat.pl
File metadata and controls
executable file
·73 lines (64 loc) · 1.18 KB
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
#!/usr/bin/perl -w
use strict;
my $headerfile;
my $noheader;
my $include;
while ($ARGV[0] =~ /^\-/) {
my $opt = shift @ARGV;
if ($opt eq '--headerfile') {
$headerfile = shift @ARGV;
}
elsif ($opt eq '--noheader') {
$noheader = 1;
}
elsif ($opt eq '-i' || $opt eq '--include') {
$noheader = 1;
$include = 1;
}
}
print_obo_header();
foreach (@ARGV) {
catfile($_);
}
exit 0;
sub catfile {
my $f=shift;
print STDERR "F=$f INC=$include\n";
my $ok = open(F,$f);
if (!$ok) {
warn("no such file: $f\n");
return;
}
if (!$include) {
print STDERR "Skipping header INC=$include\n";
# skip header
while (<F>) {
last if /^\s*$/;
}
}
# never do this again
$include = 0;
while (<F>) {
print;
}
print "\n\n";
close(F);
#print `cat $f`;
#print "\n";
}
sub print_obo_header {
if ($noheader) {
return;
}
if ($headerfile) {
catfile($headerfile,1);
print "\n";
return;
}
print <<EOM;
format-version: 1.2
date: 23:09:2005 14:37
saved-by: obo-cat.pl
default-namespace: none
EOM
}