I have to reshape some ascii files. I have many ascii files that have collapsed the lower triangular of my matrix into row. I simply want to convert them back to the proper matrix form. So, my current data looks like this:
This is five columns of data for an 88x88 matrix. And I want to make it look like this:
I want to use awk for this, but really am a novice (and a social scientist). I suspect this is simple, but am at a loss with writing the algorithim in awk.
Any help will be hugely appreciated.
Thanks very much.
--VH
Last edited by vgersh99; 04-26-2010 at 06:13 PM..
Reason: code tags, please!
I have a file that has a pattern 2 lines, blanktwo line
If encountering the first line, the 2nd line need to be converted to UPPERCASE...or...conver the 2nd line after ablank into uppercase
Is there a 'tr' function in awk..(probably the best tool over sed) ?
i.e.
......................... (6 Replies)
I have a string like below. Now i want to split this string like below and put the value in the array using awk. I am able to do it using bash but getting no clue for doing it in awk
O/P
A=0
A=01
A=014
A=0143
A=01438
A=014387
A=0143876
A=01438765
A=014387650
... (7 Replies)
Hi all!
I have 10.000 files having generally this format:
text text text
text num text num text num
text text text GAP number text text
text num text num text num RMS num
text num text num text num
...
what I want is to copy the files if the GAP number is lower than a value e.g. <100... (5 Replies)
Hi,
I was wondering if there is a way of using awk to extract the lower or upper triangular matrix from a symmetric matrix. Say I have this matrix:
$ cat data:
1 0 9 6 7 9
0 8 2 8 9 0
9 2 6 9 4 3
6 8 9 6 9 4
7 9 4 9 9 7
9 0 3 4 7 9
I am trying to do two things.
Result 1:
0 9 2 6 8... (4 Replies)
Hi, every one. I have two files ,one is in matrix like this, one is a list with the same data as the matrix.
AB AE AC AD AA AF
SA 3 4 5 6 4 6
SC 5 7 2 8 4 3
SD 4 6 5 3 8 3
SE 45 ... (5 Replies)
Hi there,
If anyone can help me sorting out this small task would be great. Given a matrix like the following:
100 3 3 3 3 3 ...
200 5 5 5 5 5 ...
400 1 1 1 1 1 ...
500 8 8 8 8 8 ...
900 0 0 0 0... (5 Replies)
Hi everyone
I am very new at awk but think that that might be the best strategy for this. I have a matrix very similar to a correlation matrix and in practical terms I need to convert it into a list containing the values from the matrix (one value per line) with the first field of the line (row... (5 Replies)
I want to code a triangular window in an array. The array size is an odd number and indices start from 1.
For example Having the number of elements N = 13
The middle position 7, the value will be 1.0 Then things decrease to zero using a rectangular variation.
Having problem how to code it. (2 Replies)
I want to print the 1st field in a comma seperated file to lower case and the rest the case they are.
I tried this
nawk -F"," '{print tolower($0)}' OFS="," file
this converts whole line in to lower case i just want the first column to be converted.
The below doesnt work because in... (11 Replies)