So one of the first things I did after getting started with perl several years ago was to create a general purpose script that I called "shloop" (as in "shell loop", or more exactly, "sh loop", because it's really just an easier, more flexible tool to use in place of the "for x in ..." loop in (ba)sh). I posted it here.
If there's a process called "mktrace" which only accepts one file name, and I have a long list of file names, I could do:
Or if the list were all files in the current directory whose names end in ".fasta" or somesuch, I could do:shloop -e mktrace filename.list
On unix, it starts by opening a shell with:ls *.fasta | shloop -e mktrace
Then on each iteration of the loop (as it reads lines from STDIN or a list file), it assembles a "$commandline" by putting the list element together with the value of the "-e" option, and then just does:open( SH, "| /bin/sh" ) or die "Couldn't start sub-shell";
The pod provided with the script is pretty extensive (there are a lot more options, like using regex substitutions to create a proper output file spec from the input, putting input and output strings at various points in the command string, etc). If it doesn't suit your needs, it might at least provide some ideas for things to try.print SH $commandline;
In reply to Re: feeding info to C programs....
by graff
in thread feeding info to C programs....
by bioinformatics
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |