forked from cmungall/obo-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobo-cat.pl
executable file
·63 lines (55 loc) · 957 Bytes
/
obo-cat.pl
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
#!/usr/bin/perl -w
use strict;
my $headerfile;
my $noheader;
while ($ARGV[0] =~ /^\-/) {
my $opt = shift @ARGV;
if ($opt eq '--headerfile') {
$headerfile = shift @ARGV;
}
if ($opt eq '--noheader') {
$noheader = 1;
}
}
print_obo_header();
foreach (@ARGV) {
catfile($_);
}
exit 0;
sub catfile {
my $f=shift;
my $include=shift;
my $ok = open(F,$f);
if (!$ok) {
warn("no such file: $f\n");
return;
}
unless ($include) {
while (<F>) {
last if /^\s*$/;
}
}
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
}