lining up columns of data


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting lining up columns of data
# 1  
Old 05-16-2006
lining up columns of data

Hi,

I have two files containing clumns of data and now I'd like to merge them into one.

File one, 1.dat, contains 7 data columns and file two, 2.dat, contains 6 data columns

I need a third file, 3.dat, containing on the first 7 columns the data of file 1.dat and on the 8th, 9th etc the 6 data columns of dat.2

Any hint?

thanks

Pau
# 2  
Old 05-16-2006
Assuming that the field separator is " ":
Code:
awk 'BEGIN{while ((getline L1<"file1")>0){if ((getline L2<"file2")==0){L2=""}print L1" "L2}}'>file3

Bye
# 3  
Old 05-16-2006
Try this :

paste -d' ' 1.dat 2.dat > 3.dat
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help - manipulate data by columns and repeated

Hello good afternoon to everyone. I'm new to the forum and would like to request your help in handling data. I hope my English is clear. I have a file (Dato01.txt) to contine the following structure. # Col1 - Col2 - Col3 - Col4 Patricia started Jun 22 05:22:58 Carolina started Jun... (5 Replies)
Discussion started by: kelevra
5 Replies

2. Shell Programming and Scripting

[BASH] Lining ascii boxes up next to each other

Hello all, I'm writing a simple little game to get myself back into BASH, but am getting unstuck with some formatting. I have the following code: let len=${#binary} for ((j=0; j < len; j++)) do echo "+-----+" echo "| ${binary:j:1} |" echo ... (8 Replies)
Discussion started by: whyte_rhyno
8 Replies

3. UNIX for Dummies Questions & Answers

2 columns of data

Hello folks, I have been learning Linux for a couple of weeks, and i am facing a simple problem that i couldn't resolve. I have a file with 2 columns of data, the first coloumn always has text, and the second coloumn sometimes has text and, sometimes blank. I want to make a new file with the... (5 Replies)
Discussion started by: Error404
5 Replies

4. Shell Programming and Scripting

Help need to subtract the data from 2 columns

space_used.lst /dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata01 505G 318G 175G 65% /dborafiles/nethealth21/PV/oradata01 /dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata02 505G 433G 67G 87% /dborafiles/nethealth21/PV/oradata02 /dev/vx/dsk/A06487-S01-c4e3s-ORACLE-dg/oradata03 507G 422G 79G 85%... (4 Replies)
Discussion started by: sathik
4 Replies

5. UNIX for Dummies Questions & Answers

How to compare two columns and retrieve data

I am a newbie to Unix and slowly learning it. I have a large data set with 8 different columns. I want to compare two columns and retrieve data if the two columns have similar number. I have attached the example. There are two columns (S-Contig and N-Contig). I want to retrieve the data from... (7 Replies)
Discussion started by: bjorngill
7 Replies

6. UNIX for Dummies Questions & Answers

Suggestion to convert data in rows to data in columns

Hello everyone! I have a huge dataset looking like this: nameX nameX 0 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 ............... nameY nameY 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 ..... nameB nameB 0 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 ..... (can be several thousands of codes) and I need... (8 Replies)
Discussion started by: kush
8 Replies

7. Shell Programming and Scripting

Data in Rows to Columns

Hi, I am a beginner in bash&perl. I have data in form of:- A 1 B 2 C 3 D 4 E 5 I would like your help to find a simple way to change it to :- A B C D E 1 2 3 4 5 Any help would be highly appreciated. (8 Replies)
Discussion started by: umaars
8 Replies

8. Shell Programming and Scripting

Separating data from one column into two columns

Hello, I have a file that contains 64,235 columns and over 1000 rows and looks similar to this: ID dad mom 1 2 3 4 5.... 64232 1234 5678 6789 AA BB CC DD EE....ZZ 1342 5786 6897 BB CC DD EE FF....AA 1423 5867 6978 CC DD EE FF GG....BB I need to leave the first three columns in... (4 Replies)
Discussion started by: doobedoo
4 Replies

9. Shell Programming and Scripting

Greping columns data from file.

Hi i am using shell script which perform oracle database query and after that output is redirect to some temporary file. the output of this file looks like SQL*Plus: Release 10.2.0.2.0 - Production on Tue Aug 5 16:08:06 2008 Copyright (c) 1982, 2005, Oracle. All Rights Reserved. ... (6 Replies)
Discussion started by: esungoe
6 Replies

10. Shell Programming and Scripting

sort data in different columns

Hello all: i have list with the following format Id Name Iid Value 0x4440001 customerCode 44077 0x11d2a PrimaryAddress 57.217.41.201 0x129fa ... (15 Replies)
Discussion started by: mogabr
15 Replies
Login or Register to Ask a Question