我有一个如下所示的bashloop:
for f in sorted*.bam; do
echo "Counts for positive: " $f
bedtools coverage -a my_region.bed -b $f -bed -s
echo "Counts for negative: " $f
bedtools coverage -a my_region.bed -b $f -bed -S
done > >(tee total_coverage_on_each_strand.txt) 2>&1
我为$ f = 1保存为total_coverage_on_each_strand.txt
的输出看起来像这样:
Counts for positive: sorted1.bam
reverseKF898354 0 14580 my_region 0 + 200229 14347 14580 0.9840192
Counts for negative: sorted1.bam
reverseKF898354 0 14580 my_region 0 + 305934 14320 14580 0.9821674
我想知道是否有一种方法可以将其保存在变量中,而不是执行> >(tee total_coverage_on_each_strand.txt) 2>&1
。我需要在上面的for循环中做些什么,以便可以代替下面的内容?
sample type counts
sorted1.bam Counts for positive 200229
sorted1.bam Counts for negative 305934