结果在同一个文件夹中 [英] result in the same folder
本文介绍了结果在同一个文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图执行以下命令来对文件夹内找到的数据进行分析,但是,将其保存在执行行的文件夹中,如何将结果保存在文件夹中?该文件位于吗?
I have tried to execute the following command to perform an analysis of the data found inside a folder, however, it saves them in the folder from where I execute the line, how can I make the result be saved in the folder where the file is located ?
sed -n 14,71p * _fastqc/* fastqc.txt |awk'{print $ 1"" $ 2}'|awk'{sum + = $ 2;n ++} END {如果(n> 0)打印总和/n;}'>QC-report.txt
推荐答案
循环是必经之路
find *_fastqc -name "*fastqc.txt" -maxdepth 1 -print0 | while IFS= read -r -d '' line; do
directory=$(dirname $line);
sed -n 14,71p "$line" | awk '{print $1" "$2}'| awk '{ sum += $2; n++ } END { if (n > 0) print sum / n; }' > "$directory"/QC-report.txt
done
这篇关于结果在同一个文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文