Mercurial > repos > devteam > show_tail
annotate tailWrapper.pl @ 0:4d280e872e75 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
author | devteam |
---|---|
date | Mon, 09 Nov 2015 11:56:33 -0500 |
parents | |
children |
rev | line source |
---|---|
0
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
1 #! /usr/bin/perl -w |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
2 |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
3 use strict; |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
4 use warnings; |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
5 |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
6 # a wrapper for tail for use in galaxy |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
7 # lessWrapper.pl [filename] [# lines to show] [output] |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
8 |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
9 die "Check arguments" unless @ARGV == 3; |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
10 die "Line number should be an integer\n" unless $ARGV[1]=~ m/^\d+$/; |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
11 |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
12 open (OUT, ">$ARGV[2]") or die "Cannot create $ARGV[2]:$!\n"; |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
13 open (TAIL, "tail -n $ARGV[1] $ARGV[0]|") or die "Cannot run tail:$!\n"; |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
14 while (<TAIL>) { |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
15 print OUT; |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
16 } |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
17 close OUT; |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
18 close TAIL; |
4d280e872e75
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
devteam
parents:
diff
changeset
|
19 |