Sponsored Content
Full Discussion: Table to Matrix
Top Forums Shell Programming and Scripting Table to Matrix Post 302656655 by elixir_sinari on Friday 15th of June 2012 07:09:48 AM
Old 06-15-2012
Try

Code:
awk '{if(NF>max) max=NF} END{while(getline<"file"){for(i=NF+1;i<=max;i++)$i="0";print}}' file

This User Gave Thanks to elixir_sinari For This Post:
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is it possible to draw table/matrix using shell script?

Hi all, I need to create a matrix of variable rows and columns. Right now i have 3 rows and two columns and following values. Output something like TypeA TypeB TestCase1 Pass Fail TestCase2 Pass ... (2 Replies)
Discussion started by: jakSun8
2 Replies

2. Shell Programming and Scripting

diagonal matrix to square matrix

Hello, all! I am struggling with a short script to read a diagonal matrix for later retrieval. 1.000 0.234 0.435 0.123 0.012 0.102 0.325 0.412 0.087 0.098 1.000 0.111 0.412 0.115 0.058 0.091 0.190 0.045 0.058 1.000 0.205 0.542 0.335 0.054 0.117 0.203 0.125 1.000 0.587 0.159 0.357... (11 Replies)
Discussion started by: yifangt
11 Replies

3. Shell Programming and Scripting

select values from db1 table and insert into table of DB2

Hi I am having three oracle databases running in three different machine. their ip address is different. from one of the DB am able to access both the databases.(means am able to select values and insert values in to tables individually.) I need to fetch some data from DB1 table(say DB1 ip is... (2 Replies)
Discussion started by: aemunathan
2 Replies

4. Ubuntu

How to convert full data matrix to linearised left data matrix?

Hi all, Is there a way to convert full data matrix to linearised left data matrix? e.g full data matrix Bh1 Bh2 Bh3 Bh4 Bh5 Bh6 Bh7 Bh1 0 0.241058 0.236129 0.244397 0.237479 0.240767 0.245245 Bh2 0.241058 0 0.240594 0.241931 0.241975 ... (8 Replies)
Discussion started by: evoll
8 Replies

5. Shell Programming and Scripting

Read in Table as a matrix

Dear forum users, i'm trying to read a table with 40x122 data in a array. Following this, i'd plot each rows again the header of the file in gnuplot. i was thinking for something like that #!/bin/bash # reads from the $ips file and assigns to $MYARRAY #IFS =";" split the line after the... (6 Replies)
Discussion started by: servuskelb
6 Replies

6. Shell Programming and Scripting

How to sort matrix table in UNIX?

Hello All, i have a file sort.txt with below entries. 1 12 10 16 6 4 20 8 15 i need to sort these entries and the out put should come in a single line. 1 4 6 8 10 12 15 16 20 Can you please help me sort this out? (2 Replies)
Discussion started by: sureshk_85
2 Replies

7. Shell Programming and Scripting

awk to convert table-by-row to matrix table

Hello, I need some help to reformat this table-by-row to matrix? infile: site1 A:o,p,q,r,s,t site1 C:y,u site1 T:v,w site1 -:x,z site2 A:p,r,t,v,w,z site2 C:u,y site2 G:q,s site2 -:o,x site3 A:o,q,s,t,u,z site3 C:y site3 T:v,w,x site3 -:p,routfile: SITE o p q r s t v u w x y... (7 Replies)
Discussion started by: yifangt
7 Replies

8. Web Development

Getting Rid of Annoying Bootstrap Table Borders and Wayward Table Lines

Bootstrap is great; but we have had some issues with Bootstrapped <tables> (and legacy <fieldset> elements) showing annoying, wayward lines. I solved that problem today with this simple jQuery in the footer: <script> $(function(){ $('tr, td, fieldset,... (0 Replies)
Discussion started by: Neo
0 Replies
doc::lua-oocairo-matrix(3)				       Lua OO Cairo binding					doc::lua-oocairo-matrix(3)

Name
       lua-oocairo-matrix - Transformation matrix table

Introduction
       Matrix objects are used in Cairo to represent affine transformations like rotation and scaling.	They are used for transforming both fonts
       and paths drawn on surfaces.

       This binding uses normal Lua tables for matrices, with each matrix being an array of six numbers.  You can use any such table when
       supplying a matrix to a method, but the ones returned by this module have a metatable set so that the methods listed below can be called on
       it.

       The "matrix_create" function in the module table can be used to create a new identity matrix.

Methods
       The following methods can be called on a matrix object.	Unless otherwise stated they do not return any values.	The transformations alter
       the matrix you supply by adjusting the numbers in the table, rather than creating a new table.

       mat:invert ()
	   Set mat to its inverse, which will result in a transformation which reverses what it did originally.  Not all matrices have an inverse,
	   and if none can be found then an exception will be thrown.

       mat1:multiply (mat2)
	   Multiply mat1 by mat2, leaving mat2 unchanged.  This has the effect of combining the transformations represented by the two matrices.

       mat:rotate (ang)
	   Apply a rotation by ang radians to mat.

       mat:scale (sx, sy)
	   Apply a scaling transformation to mat.

       mat:transform_distance (x, y)
	   Transform the distance given, using mat, and return two numbers giving the resulting distance.  This will have the same effect as
	   "mat:transform_point()" but without any translation taking place.

       mat:transform_point (x, y)
	   Transform the position of the coordinates, which must be numbers, to the matrix, and return two numbers giving the resulting position.

       mat:translate (x, y)
	   Apply a translation to mat.

1.4								    2011-05-18						doc::lua-oocairo-matrix(3)
All times are GMT -4. The time now is 10:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy