Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting data from files along some coordinates

Status
Not open for further replies.

mguha06

Technical User
Apr 20, 2006
28
US
Dear Friends,

I have a question regarding extracting some data from a series of matrix files (large files) along any cooordinate lines. Here is an example as what I meant:

5 8 12 7
9 3 8 6 File1.dat
4 5 7 4


3 6 4 4
5 8 7 3 File2.dat
2 0 1 1.2


8 3 1 6
7 7 2 4 File3.dat
0 1 2.3 4


The above are 3 files in 3 by 4 matrix.

I want to extract, for example data from the following cells of the matrices: (3,1); (2,2) and (2,3).

Thus, the output result from File1.dat would be: 4, 3, and 8.

Thus, the output result from File2.dat would be: 2, 8, and 7.

Thus, the output result from File3.dat would be: 0, 7, and 2.


If any one can write a generic code, where proving the matrix coordinates to be extracted from large matrix files would be of tremendous help.

Any help will be very greatly appreciated with all stars.

Thanks.

 
Have you tried anything yet? awk supports arrays with multiple subscripts, so you could simply read each file into an array, and then output the values you want using print myarray[3,1],myarray[2,2],myarray[2,3], for example.

Annihilannic.
 
Annihilannic,

I am using AWK95, I am still getting error in outputting the data as you suggested. Is there any other way.

Thanks.
 
without seeing what you've tried so far. it's hard to say.....

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top