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
In reply to Re^2: capture STDOUT without printing to screen
by k99ja04
in thread capture STDOUT without printing to screen
by k99ja04
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |