I am trying to extract columns from multiple text files(3000 files). The sample of my text file is shown below.
res ABS sum
SER A 1 161.15 138.3
CYS A 2 66.65 49.6
PRO A 3 21.48 15.8
ALA A 4 77.68 72.0
ILE A 5 15.70 9.0
HIS A 6 10.88 5.9
I would like to print 1) resnames(first column) only if the sum(last column) is >25. 2) I would like to store the output in to one file 3) I would like to add a new column to the outputfile with the name of the txt file from where the data was extracted and also need to print the total number of resnames( from all text files only if sum is >25)
我谨获得以下产出:
SER AA.txt
CYS AA.txt
ALA AA.txt
SER BB.txt
Total numberof SER- 2
Total number of ALA- 1
Total number of CYS- 1
我怎样才能以巴什获得这一产出? 我尝试了以下法典:
for i in files/*.txt
do
awk BEGIN{FS=OFS=" "}{if($5 > 25) print $1,i}
done
Any suggestions please?