in reply to Re: capture STDOUT without printing to screen
in thread capture STDOUT without printing to screen
I am using Mac OS X so it is unix. Here's my full code.
#!/usr/bin/perl -w if (@ARGV==0) { die "Usage: countseq.pl <dbname>\n"; } my $prog = "/usr/ncbi/blast2/xdformat -n -i $ARGV[0]"; my $strOutput; my @output = `$prog`; foreach my $line (@output) { if (/^No. of sequences \(letters\): ([\d,])\s/) { $strOutput = $1; } } die "No output gathered \n" unless defined($strOutput); print $strOutput;
So from the shell here's what I get.
myshell$ ./countseq.pl human
Version
Release date:
Creation date: 2:17:09 AM EST Nov 19, 2004
Modified date: 2:17:09 AM EST Nov 19, 2004
Type: Nucleotide
Alphabet: NCBI2na(1)
No. of sequences (letters): 37,316 (33,115,935)
Longest sequence: 1542
Edit Alphabet: WUStLna(1)
Max. edits: 41
Total edits: 2693
37316
myshell$
I just want to see the number on the bottom (37316) Any thoughts? Any idea on how to determine if xdformat is printing to anything other than STDOUT?
Thanks, Jared
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: capture STDOUT without printing to screen
by hmerrill (Friar) on Dec 07, 2004 at 12:47 UTC |