我的操作系统是Windows 10,我在Windows上使用bash执行Linux命令。我有一个96行的文件,并且有多个文件覆盖了该文件的每三行,我想将它们的均值和标准差逐行添加到单个文件中。
单个文件
1 31.31
2 32.24
3 32.11
4 20.97
5 20.93
6 20.91
7 22.58
8 22.46
9 22.52
10 20.71
11 20.25
12 20.51
文件1
1 31.31
2 32.24
3 32.11
文件2
4 20.97
5 20.93
6 20.91
文件3
7 22.58
8 22.46
9 22.52
首先,我尝试将详细模式下的文件拆分为多个文件
grep -i 'Sample' Sample3.txt | awk '{print $5,$6}' | sed 's/\,/\./g' >> Sample4.txt | split -l3 Sample4.txt --verbose
tcsh命令(例如foreach和awk)可以用于bash脚本编写吗?我们可以在单个文本文件中执行此操作,还是必须将单个文件拆分为文件?
例如输出可以是:
output.txt
mean stand.D.
31.88667 0.50362 ----- first three rows mean and sd
20.93667 0.030 ----- second three rows mean and sd
22.52 0.06 ----- third three rows mean and sd
etc etc etc