10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hello, I have three files in the following order
==> File1 <==
1 20977000 20977000 A C 1.00 0,15 15 45
1 115829313 115829313 G A 0.500 6,7 13 99
==> File2 <==
1 20977000 20977000 A C 1.00 0,13 13 39
1 115829313 ... (5 Replies)
Discussion started by: nans
5 Replies
2. Shell Programming and Scripting
Hi forum members,
I'm trying to get an average of multiple columns in a csv file using awk. A small example of my input data is as follows:
cu,u3o8,au,ag
-9,20,-9,3.6
0.005,30,-9,-9
0.005,50,10,3.44
0.021,-9,8,3.35
The following code seems to do most of what I want
gawk -F","... (6 Replies)
Discussion started by: theflamingmoe
6 Replies
3. Emergency UNIX and Linux Support
Hi Friends,
I have files with columns like this. This sample input below is partial.
Please check below for main file link. Each file will have only two rows.
... (8 Replies)
Discussion started by: jacobs.smith
8 Replies
4. Shell Programming and Scripting
I have the following format of input from multiple files
File 1
24.01 -81.01 1.0
24.02 -81.02 5.0
24.03 -81.03 0.0
File 2
24.01 -81.01 2.0
24.02 -81.02 -5.0
24.03 -81.03 10.0
I need to scan through the files and when the first 2 columns match I... (18 Replies)
Discussion started by: ncwxpanther
18 Replies
5. Shell Programming and Scripting
I have the need to match the first two columns and when they match, calculate the percent of average for the third columns. The following awk script does not give me the expected results.
awk 'NR==FNR {T=$3; next} $1,$2 in T {P=T/$3*100; printf "%s %s %.0f\n", $1, $2, (P>=0)?P:-P}' diff.file... (1 Reply)
Discussion started by: ncwxpanther
1 Replies
6. Shell Programming and Scripting
Hi experts,
I want to group by average, for multiple columns starting column $7 until NF,
group by ($1-$5), please help
For just 7th column, I can do
awk '
NR>1{
arr += $7
count += 1
}
END{
for (a in arr) {
print a, arr/count
... (10 Replies)
Discussion started by: ritakadm
10 Replies
7. UNIX for Dummies Questions & Answers
I have a dataset with 120 columns. I would like to write a script, that takes the average of every two columns, starting from columns 2 and 3, and moving consecutively in frames of 3 columns, all the way until the last column.
The first column in the output file would be the averages of columns... (1 Reply)
Discussion started by: evelibertine
1 Replies
8. Shell Programming and Scripting
Hi, I need help with the awk command.
I have a folder with aprox 500 files each one with two columns and I want to print in a new file, the average of column 1 and average of column 2 and the name of each file.
Input files are:
File-1:
100 99
20 99
50 99
50 99
File-2:
200 85... (3 Replies)
Discussion started by: Lokaps
3 Replies
9. Shell Programming and Scripting
I have a lot of input files that have the following form:
Sample Cq Sample Cq Sample Cq Sample Cq Sample Cq
1WBIN 23.45 1WBIN 23.45 1CVSIN 23.96 1CVSIN 23.14 S1 31.37
1WBIN 23.53 1WBIN 23.53 1CVSIN 23.81 1CVSIN 23.24 S1 31.49
1WBIN 24.55 1WBIN 24.55 1CVSIN 23.86 1CVSIN 23.24 S1 31.74 ... (3 Replies)
Discussion started by: isildur1234
3 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I have a space delimited text file that looks like the following:
Aa 100 200
Bb 300 100
Cc X 500
Dd 600 X
Basically, I want to take the average of columns 2 and 3 and print it in column 4. However if there is an X in either column 2 or 3, I want to print the non-X value. Therefore... (11 Replies)
Discussion started by: evelibertine
11 Replies