Sponsored Content
Top Forums Shell Programming and Scripting Convert data into tabular matrix Post 302931923 by RudiC on Friday 16th of January 2015 12:00:01 PM
Old 01-16-2015
Please control your use of code tags!

You'll have to remove the DOS <CR> line terminators before any of these solutions work.
Try also
Code:
awk     '       {LN[$4]; HD[$5]; MX[$4,$5]=$NF}
         END    {               printf "%10s", ""; for (i in HD) printf "%10s", i; print "";
                 for (j in LN) {printf "%10s",j;   for (i in HD) printf "%10s", MX[j,i]; print ""}
                }
        ' file
            window10   window1   window2   window3   window4   window5   window6   window7   window8   window9
   NACpG_1         1         1         1         1         1         1         1         1         1         1
   NACpG_2      0.90         1      0.29      0.29      0.98      0.98      0.97      0.17      0.17      0.11
 NANoCpG_3         0         1         1         1         0         0         0         0         0         0

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

converting a tabular format data to comma seperated data in KSH

Hi, Could anyone help me in changing a tabular format output to comma seperated file pls in K-sh. Its very urgent. E.g : username empid ------------------------ sri 123 to username,empid sri,123 Thanks, Hema:confused: (2 Replies)
Discussion started by: Hemamalini
2 Replies

2. UNIX for Dummies Questions & Answers

How to read tabular data?

Hello, I have a log file which contains data in tabular format(3 columns(total, posted, rejected) and 2 rows(close, total)) as below. TOTAL POSTED REJECTED CLOSE 3 3 0 TOTAL 3 3 0 I have to search for all Total... (1 Reply)
Discussion started by: akash028
1 Replies

3. Shell Programming and Scripting

How to find max value in a tabular data?

FILE_NAME VER TYPE DELETED_DATE CREATED_DATE SIZE LOCATION hello 1 d 2010-08-09 2010-08-09 4096 /home/xxxxx/project/ hello 2 d 2010-08-09 2010-08-09 4096 /home/xxxxx/project/ hello 3 d 2010-08-09 2010-08-09 4096 /home/xxxxx/project/ hello 4 d 2010-08-09 2010-08-09 4096 /home/xxxxx/project/ ... (4 Replies)
Discussion started by: classic
4 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

convert data into matrix- awk

is it possible to count the number of keys based on state and cell and output it as a simple matrix. Ex: cell1-state1 has 2 keys cell3-state1 has 4 keys. Note: Insert 0 if no data available. input key states cell key1 state1 cell1 key1 state2 cell1 key1 ... (21 Replies)
Discussion started by: quincyjones
21 Replies

6. UNIX for Dummies Questions & Answers

Put data into tabular form

Hi I am having a file which is required to be presented in the under-noted output form. Please suggest. Input: Kapil: apple 4 banana 6 cherry 0 Manoj: apple 13 banana cheery 2 Output: apple banana cherry Kapil: 4 6 0 Manoj: 13 2 Thanks in... (4 Replies)
Discussion started by: vanand420
4 Replies

7. Shell Programming and Scripting

Generate tabular data based on a column value from an existing data file

Hi, I have a data file with : 01/28/2012,1,1,98995 01/28/2012,1,2,7195 01/29/2012,1,1,98995 01/29/2012,1,2,7195 01/30/2012,1,1,98896 01/30/2012,1,2,7083 01/31/2012,1,1,98896 01/31/2012,1,2,7083 02/01/2012,1,1,98896 02/01/2012,1,2,7083 02/02/2012,1,1,98899 02/02/2012,1,2,7083 I... (1 Reply)
Discussion started by: himanish
1 Replies

8. UNIX for Dummies Questions & Answers

Convert nxm Matrix into columns of data

Dear Unixers, I'm having some difficulty in converting an n x m data matrix into a dataset of 3 columns and nxm rows. As an example I want to convert this dataset 2 3 4 5 2 0.0 0.0 0.1 0.1 6 -0.3 2.0 0.0 0.3 7 -0.6 -1.1 0.5 0.3 9 -0.9 -4.1 -0.7 0.5 ... (2 Replies)
Discussion started by: tintin72
2 Replies

9. Shell Programming and Scripting

Convert data to a tabular format

How can i convert the below data to a simpler format :- cat tabular.txt User 1 Details :- First Name = Tom Middle Name = Last Name = Hanks Age = 40 Address = User 2 details :- First Name = Mike Middle Name = Last Name = Tyson Age = 50 Address = (2 Replies)
Discussion started by: lazydev
2 Replies

10. Shell Programming and Scripting

Convert text file to HTML tabular format.

Please provide script/commands to convert text file to HTML tabular format. No need of styles and colours, just output and a heading in table is required. Output file will be send via email and will be seen from outlook. (script required without using awk). output file content: (sar... (7 Replies)
Discussion started by: Veera_V
7 Replies
ProcessTable(3pm)					User Contributed Perl Documentation					 ProcessTable(3pm)

NAME
Proc::ProcessTable - Perl extension to access the unix process table SYNOPSIS
use Proc::ProcessTable; $p = new Proc::ProcessTable( 'cache_ttys' => 1 ); @fields = $p->fields; $ref = $p->table; DESCRIPTION
Perl interface to the unix process table. METHODS
new Creates a new ProcessTable object. The constructor can take the following flags: enable_ttys -- causes the constructor to use the tty determination code, which is the default behavior. Setting this to 0 diables this code, thus preventing the module from traversing the device tree, which on some systems, can be quite large and/or contain invalid device paths (for example, Solaris does not clean up invalid device entries when disks are swapped). If this is specified with cache_ttys, a warning is generated and the cache_ttys is overridden to be false. cache_ttys -- causes the constructor to look for and use a file that caches a mapping of tty names to device numbers, and to create the file if it doesn't exist (this file is /tmp/TTYDEVS by default). This feature requires the Storable module. fields Returns a list of the field names supported by the module on the current architecture. table Reads the process table and returns a reference to an array of Proc::ProcessTable::Process objects. Attributes of a process object are returned by accessors named for the attribute; for example, to get the uid of a process just do: $process->uid The priority and pgrp methods also allow values to be set, since these are supported directly by internal perl functions. EXAMPLES
# A cheap and sleazy version of ps use Proc::ProcessTable; $FORMAT = "%-6s %-10s %-8s %-24s %s "; $t = new Proc::ProcessTable; printf($FORMAT, "PID", "TTY", "STAT", "START", "COMMAND"); foreach $p ( @{$t->table} ){ printf($FORMAT, $p->pid, $p->ttydev, $p->state, scalar(localtime($p->start)), $p->cmndline); } # Dump all the information in the current process table use Proc::ProcessTable; $t = new Proc::ProcessTable; foreach $p (@{$t->table}) { print "-------------------------------- "; foreach $f ($t->fields){ print $f, ": ", $p->{$f}, " "; } } CAVEATS
Please see the file README in the distribution for a list of supported operating systems. Please see the file PORTING for information on how to help make this work on your OS. AUTHOR
D. Urist, durist@frii.com SEE ALSO
Proc::ProcessTable::Process.pm, perl(1). perl v5.14.2 2013-02-10 ProcessTable(3pm)
All times are GMT -4. The time now is 01:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy