0

I need to run a command on multiple files. The output should be cor_FILENAME and cov_FILENAME and hence I have the following:

find . -name "*.tsv" -exec fastspar --otu_table {} --correlation bootstrap_correlation/cor_{} --covariance bootstrap_correlation/cov_{} \;

This command does not give yield any output files (correlation or covariance files). Interestingly, when I place the cor_ and cov_ prefixes as suffixes:

find . -name "*.tsv" -exec fastspar --otu_table {} --correlation bootstrap_correlation/{}_cor --covariance bootstrap_correlation/{}_cov \;

the command runs as expected. What am I missing?

  • 2
    Look at the output of find . -name "*.tsv" -exec echo bc/aaa_{} bc/{}_zzz \;. You'll spot the problem immediately – roaima Jan 10 at 14:00
  • Thank you. Now I understand the problem. I will look into how to remove the path from the output. – user2913053 Jan 10 at 18:44
  • If you get stuck with that you'll definitely get help here. Demonstrating your own attempts, and that you understand the issue, always goes down well. – roaima Jan 10 at 20:32
  • In case other novice users run into a similar problem. After understanding the problem, it could be solved by changing "find ." to "find *" which strips the leading "./". For other ways to solve the problem see: stackoverflow.com/questions/2596462/… – user2913053 Jan 11 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.