-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathR_settings.pl
executable file
·54 lines (44 loc) · 1.09 KB
/
R_settings.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
#!/usr/bin/envd perl
$commentChar = $ARGV[0];
# print "commentChar = $commentChar\n";
if ($#ARGV+1 < 1) {
print "\n\tUsage: stripComments.pl char <input >output\n";
print "\n\tNotes: Output contains all text to the left of the first comment char.\n";
exit -1;
}
sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
# sub trim {
# return $_[0] =~ s/^\s+|\s+$//rg;
# }
foreach $line (<STDIN>) {
chomp($line);
$line=trim($line);
# print "line = $line\n";
$firstChar = substr($line, 0, 1);
$sevenChars = substr($line, 0, 7);
if ($firstChar eq $commentChar) {
# print "firstChar = $firstChar\n";
# do nothing!
}
elsif ($sevenChars eq "export ") {
# do nothing!
}
elsif ($line =~ /\(/){
# do nothing!
}
elsif ($line =~ /\[/){
# do nothing!
}
elsif ($line !~ /=/){
# do nothing!
}
else {
@entries = split($commentChar, $line);
$length=@entries;
# print "length = $length\n";
print "$entries[0]\n";
#print @entries;
#$size = @entries;
#print $size;
}
}