The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to chk the file name using wildcards?? RRVARMA Shell Programming and Scripting 7 07-10-2008 11:23 AM
Separate based on file names prashk15 Shell Programming and Scripting 2 02-04-2008 09:37 AM
Reading file names from a file and executing the relative file from shell script anushilrai Shell Programming and Scripting 4 03-10-2006 05:25 AM
File names giantflameeater UNIX for Dummies Questions & Answers 9 11-24-2004 07:03 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-30-2008
tcquad tcquad is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 1
File names based off of wildcards

Hello all-

First post, so just to forewarn you: I know enough about Perl and the Terminal to get myself into trouble, not quite enough to always get out.

I'd like to know if it is possible to, from the command prompt, use a wild-card to declare the names of files for input and then use the value of the wild card in the same line to declare the name for the output. I'm using the BLAST package to search through genes, so what I'd like to have is:

% blastall -p blastn -i *.dna -o (some-variable).output

The -p calls the blastn part of the package, the -i declares the input to be all the genes in the directory and the -o declares the output. I'd like it if a geneA.dna file, for instance, produced an output file called geneA.output.

It strikes me as one of those glaringly obvious things I've overlooked at some point, but I have no idea what could be put in the (some-variable) portion of the command. Gory details: using the public BLAST package (so I can't edit anything within there easily to... at all), executing on a Mac OS X Terminal session. If you need any other details, please let me know.
  #2 (permalink)  
Old 01-30-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
Post

Very do-able but not as easily as you'd hope:
Code:
for file in *.dna; do blastall -p blastn -i $file -o ${file}.output
Will produce a bunch of files *.dna.output
To get *.output:
Code:
for file in *.dna; do blastall -p blastn -i $file -o `echo $file | sed 's/dna$//'`.output
Incidentally, windows actually lets you do something like this:
Code:
blastall -p blastn -i *.dna -o *.output
But only for certain commands - it seems to depend on how you hold your mouth when you do it.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0