Sort command not working as expected

Posted by user964689 on Stack Overflow See other posts from Stack Overflow or by user964689
Published on 2012-06-30T15:04:25Z Indexed on 2012/06/30 15:16 UTC
Read the original article Hit count: 255

Filed under:
|
|
|

If anybody can help me to write a loop to iterate over files in a folder it would save me a huge amount of time. I think it must be quite a simple solution ,but I currently don't know how to nest a loop within a loop. So far I have this script:

cd /folderlocation/
for i in `</textfile_containing_lines_to_iterate_through`
do
 #size=`echo $i | perl -nE '/:([\d-]+)/ && say abs(eval $1)'`
  #echo "$size"
 zcat dataset | head -n 18 > temp"$i".vcf
 tabix dataset $i >> temp"$i".vcf 
 vcftools --window-pi 1000000 --vcf temp10individuals"$i".vcf >>  run_summary.txt
cat out.windowed.pi >> outputfile_2 
  #rm temp*
done
grep -v "PI" outputfile_2   > outputfile
rm outputfile_2

I need to expand this so that the script will run multiple times, through all of the 'textfiles_containing_lines_to_iterate_through'. Currently I change the name of the textfile manually each time and re-run the script. So I'd need a loop that does this for file in folder, and also that uses the name of the file as part of the outputfile name so that I can match an output file to an inputfile.

Any help would be really useful and greatly appreciated!

Many thanks in advance.

© Stack Overflow or respective owner

Related posts about bash

Related posts about loops