Writing a script to take the average of two columns every 3 rows
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 2 and 3, the second column would be the averages of columns 5 and 6, the third column would be the average of 8 and 9.
Hi friends
I have 100 files in my directory. Each file look like this..
Temp1 Temp2 Temp3
MAS 1 2 3
MAS 4 5 6
MAS 7 8 9
Delhi 10 11 12
Delhi 13 14 15
Delhi 16 17 ... (4 Replies)
Hi Friends,
In continuation to my earlier post
https://www.unix.com/shell-programming-scripting/99166-script-find-average-given-column-also-specified-number-rows.html
I am extending my problem as follows.
Input:
Column1 Column2
MAS 1
MAS 4 ... (2 Replies)
Hi Everyone,
I have a file text.cvs, which is a file with columns from excel. The data are separeted with semicolon. The content of the file looks like
A B C D E F
1 3 3 4 3 3
2 2 1 2 5 2
5 6 1 1 2 1
Now I wish to write an script which writes the colums A, C and F in... (4 Replies)
Hi everyone,
how can I convert a file with 3375 rows and 6 columns to a file with
1350 rows and 15 columns
by using a script?
Is it possible with awk or something like that?
Any help is much appreciated.
Thanks.
D. (5 Replies)
I have a script which converts rows to columns.
file_name=$1
mailid=$2
#CREATE BACKUP OF ORIGINAL FILE
#cp ${file_name}.xlsx ${file_name}_temp.xlsx
#tr '\t' '|' < ${file_name}_temp.xlsx > ${file_name}_temp.csv
#rm ${file_name}_temp.xlsx
pivot_row=`head -1 ${file_name}`
sed 1d... (3 Replies)
Hi All
I want to have a Perl script which convert columns to rows.
The Perl should should read the data from input file.
Suppose the input file is
7215484
date to date
173.3
A
1.50
2.23
8.45
10.14
2.00
4.50
2.50
31.32
7216154
month to month (3 Replies)
Hi All,
I need the modification for the below mentioned code (found in one more post https://www.unix.com/shell-programming-scripting/27161-script-generate-average-values.html) to find the average values for all the columns(but for a specific rows) and print the averages side by side.
I have... (4 Replies)
Hi
I have a file having the values like below
----------------------------
.set A
col1=”ABC”
col2=34
col3=”DEF”
col4=”LMN”
col5=25
.set A
.set B
col1=55
col3=”XYZ”
col4=”PQR”
col5=66
.set B
.set C
col2=”NNN” (1 Reply)
I got a requirement where I need to compare two files wrt to each columns and write the corresponding difference in another file along with some identification showing mismatched columns. Pointing out the mismatched columns is my main problem statement. For example we have files like:
File 1 ... (8 Replies)
Hello
I have a large database with the following structure:
Headword=Gloss1;Gloss2;Gloss3
The Glosses are separated by a ;
What I need is to reduce the multiple glosses on each row to columns
Headword=Gloss1
Headword=Gloss2
Headword=Gloss3
I had written the following script in awk... (5 Replies)