Creating a table like format with rows and columns


 
Thread Tools Search this Thread
Top Forums Programming Creating a table like format with rows and columns
# 1  
Old 04-05-2010
Creating a table like format with rows and columns

I have few files which have two columns in each.
like

e2
Code:
1	1	2694
2	4	2485
3	2	2098
5	1	2079
6	5	2022
9	4	1734
11	5	1585
13	2	1461
18	1	1092
21	2	1019
24	1	915
25	3	907
27	1	891
28	3	890
34	1	748
39	1	700
43	2	652
45	1	627
48	3	591
50	1	575
51	1	566
56	1	544
60	1	533
65	1	522
74	1	494
75	3	494
79	1	480
80	1	469
92	1	418
102	1	389
105	1	384

which has 3 fields but field one is sorted later.
now i need to create a table in such a way like
Code:
     e2 e15 e22 e25 e31........(file names)

1    1
2    4
3    2
4    0
5    1
6    5
7    0
8    0
9    4
10    0
.    .    
.
.
.
.
.
2240

where 0 are assigned if there exits no value of field to corresponding to field one
# 2  
Old 04-06-2010
Your other post contains a solution which is very similar to what you are looking for: Compare two files of 4 columns and o/p unique,append zero's
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert rows into columns and create table with awk

Hello I've four fields . They are First Name, Last Name, Age, Country. So when I run a Unix command, I get below output with these fields comes every time in different order as you can see. Some times first name is the first row and other time last name is first row in the output and etc etc..... (9 Replies)
Discussion started by: rprpr
9 Replies

2. Shell Programming and Scripting

Fill in missing rows with zero to have uniform table

Hello, I have two files of same structure except some rows are missing randomly in each file. How do I fill the missing rows to have the exact ID column (S01 ~ S96) and rest columns filled with "0" with awk? The purpose of this step is to join the two files side by side. The closest thread is... (17 Replies)
Discussion started by: yifangt
17 Replies

3. Shell Programming and Scripting

Compare 2 csv files by columns, then extract certain columns of matcing rows

Hi all, I'm pretty much a newbie to UNIX. I would appreciate any help with UNIX coding on comparing two large csv files (greater than 10 GB in size), and output a file with matching columns. I want to compare file1 and file2 by 'id' and 'chain' columns, then extract exact matching rows'... (5 Replies)
Discussion started by: bkane3
5 Replies

4. Shell Programming and Scripting

Evaluate 2 columns, add sum IF two columns match on two rows

Hi all, I know this sounds suspiciously like a homework course; but, it is not. My goal is to take a file, and match my "ID" column to the "Date" column, if those conditions are true, add the total number of minutes worked and place it in this file, while not printing the original rows that I... (6 Replies)
Discussion started by: mtucker6784
6 Replies

5. Shell Programming and Scripting

Deleting all the fields(columns) from a .csv file if all rows in that columns are blanks

Hi Friends, I have come across some files where some of the columns don not have data. Key, Data1,Data2,Data3,Data4,Data5 A,5,6,,10,, A,3,4,,3,, B,1,,4,5,, B,2,,3,4,, If we see the above data on Data5 column do not have any row got filled. So remove only that column(Here Data5) and... (4 Replies)
Discussion started by: ks_reddy
4 Replies

6. Shell Programming and Scripting

Filter rows from table

Hi , I need to filter input file according to following All rows with the following conditions should be removed 1) If in a row, the number of 'N's starting col 2 exceeds 2 (3 or more) OR 2) If a row is duplicated with the same value, starting col 2, A value 'N' is considered missing... (1 Reply)
Discussion started by: newbie83
1 Replies

7. UNIX for Dummies Questions & Answers

Creating a condensed table from a pre-existing table in putty

Hello, I'm working with putty on Windows 7 professional and I'd like to know if there's a way to gather specific lines from a pre-existing table and make a new table with that information. More specifically, I'd like the program to look at a specific column, say column N, and see if any of the... (5 Replies)
Discussion started by: Deedee393
5 Replies

8. Programming

Getting Rows from a MySQL Table with max values?

I feel stupid for asking this because it seems that MYSQL code isn't working the way that I think it should work. Basically I wrote code like this: select * from `Test_DC_Trailer` HAVING max(DR_RefKey); Where the DR_RefKey is a unique numeric field that is auto iterated (like a primary key)... (7 Replies)
Discussion started by: Astrocloud
7 Replies

9. Shell Programming and Scripting

Creating a table

I have a file like below Iter 1: Best Model = 10.0 12.0 13.0 17.0 23.3 78.7 Iter 2: Best Model = 10.0 20.0 30.0 40.0 50.0 60.0 Iter 3: Best Model = 27.3 46.3 84.5 23.0 34.5 35.4 etc I want to use a scipts using csh or awk to select the iteration number and show the numbers in a table... (2 Replies)
Discussion started by: kristinu
2 Replies

10. Shell Programming and Scripting

Shell script to extract rows from table

I have an Employee with EID, ENAME and ESTATUS as columns in SQL. I want to extract the status of an employee and update the details if the status is 'A'. Can anyone help in writing the shell script. (1 Reply)
Discussion started by: vkca
1 Replies
Login or Register to Ask a Question