combine multiple files by column into one files already sorted!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting combine multiple files by column into one files already sorted!
# 1  
Old 02-24-2011
combine multiple files by column into one files already sorted!

I have multiple files; each file contains a certain data in a column view
simply i want to combine all those files into one file in columns

example

file1:
Code:
a
b
c
d



file 2:
Code:
1
2
3
4



file 3:

Code:
G
H
J
K



The output file should be like this
out_file:
Code:
a   1  G
b   2  H
c   3  J
d   4  K



anyone can support me please? kindly note that I want to use the fastest shell program as my files include many many # of records (the above is just an example actually I'm talking about ~ 1000 record per file)

also there is no any kind of matching test required as the files are containing the same number of records and already sorted


Last edited by radoulov; 02-24-2011 at 04:56 PM.. Reason: Code tags, please!
# 2  
Old 02-24-2011
Code:
paste -d" " file1 file2 file3 > out_file

# 3  
Old 02-24-2011
Thanks a million "bartus11", although i spend much time searching for a solution but I've learned one important lesson; ask Experts is the easiest way Smilie
# 4  
Old 02-24-2011
Quote:
Originally Posted by ahmedamro
Thanks a million "bartus11", although i spend much time searching for a solution but I've learned one important lesson; ask Experts is the easiest way Smilie
Even though asking an expert is the easiest way to find an answer,
by far it is not the easiest way to learn.

If you really want to learn, you should first do extensive research,
exhaust all your possibilities, then ask an expert.

At the end you should ask yourself why you did not find a similar,
the same or a better solution.
This User Gave Thanks to Shell_Life For This Post:
# 5  
Old 02-26-2011
Then help me plz, from where shall I start?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Stack data from multiple files into one, with variable column files

Hello Gurus, Im new to scripting. Got struck with a file merge issue in Unix. Was looking for some direction and stumbled upon this site. I saw many great posts and replies but couldnt find a solution to my issue. Greatly appreciate any help.. I have three csv files -> Apex_10_Latest.csv,... (1 Reply)
Discussion started by: wamshi
1 Replies

2. Shell Programming and Scripting

Paste multiple files, but only the sorted head -50

Hello, I want to merge multiple files (under hundreds folders) side by side. File name are the same but folder are different. like folder1/same_name.txt folder2/same_name.txt folder3/same_name.txt ......Normally it can be done as paste /different_path*/same_name.txt > merged_file.txtbut... (2 Replies)
Discussion started by: yifangt
2 Replies

3. Shell Programming and Scripting

Combine Multiple Files into Single One File One after other

I am trying to combine 4 .dat files into one single Output file Inputs are:- file123.dat, file256.dat, file378.dat & file490 Expected Output:- FileName=file1 {text from file1} EOF {blank line} FileName=file2 {text from file2} EOF {blank line} FileName=file3 {text from file3} EOF... (4 Replies)
Discussion started by: lancesunny
4 Replies

4. Shell Programming and Scripting

Combine columns from multiple files

Can anybody help on the script to combine/concatenate columns from multiple files input1 4 135 5 185 6 85 11 30 16 72 17 30 21 52 22 76 input2 2 50 4 50 6 33 8 62 10 25 12 46 14 42 15 46output (2 Replies)
Discussion started by: sdf
2 Replies

5. Emergency UNIX and Linux Support

Combine multiple Files into one big file

Hi Ppl, I have a requirement like i will be getting files of huge size daily and if the file size is so huge ,the files will be split into many parts and sent.The first file will have the header details followed by detail records and the consecutive files will have detail records and the last... (11 Replies)
Discussion started by: ganesh_248
11 Replies

6. Shell Programming and Scripting

sort the files based on timestamp and execute sorted files in order

Hi I have a requirement like below I need to sort the files based on the timestamp in the file name and run them in sorted order and then archive all the files which are one day old to temp directory My files looks like this PGABOLTXML1D_201108121235.xml... (1 Reply)
Discussion started by: saidutta123
1 Replies

7. UNIX for Dummies Questions & Answers

write a program in c in unix that display the files(includ sub-direc and files within) in a sorted

the sorting is based on name of file, file size modification time stamps o f file it should dislay the output in the following format "." and ".." enteries should be ignored please give some idea how to do it (1 Reply)
Discussion started by: pappu kumar jha
1 Replies

8. Shell Programming and Scripting

Combine Multiple text or csv files column-wise

Hi All I am trying to combine columns from multiple text files into a single file using paste command but the record length being unequal in the different files the data is running over to the closest empty cell on the left. Please see below. What can i do to resolve this ? File 1 File... (15 Replies)
Discussion started by: venky_ibm
15 Replies

9. UNIX for Dummies Questions & Answers

how to combine two files together, not by row buy by column

let's say, we have: x1.txt 1 2 3 4 5 6 x2.txt 7 8 9 10 11 12 is there a very simple command like 'cat' that can makes them combine into x3.txt : 1 2 7 8 3 4 9 10 5 6 11 12 Thanks so much for help me with the dummiest questions:o (4 Replies)
Discussion started by: kaixinsjtu
4 Replies

10. Shell Programming and Scripting

Combine multiple columns from multiple files

Hi there, I was wondering if someone can help me with this. I am trying the combine multiple columns from multiple files into one file. Example file 1: c0t0d0 c0t2d0 # hostname vgname c0t0d1 c0t2d1 # hostname vgname c0t0d2 c0t2d2 # hostname vgname c0t1d0 c0t3d0 # hostname vgname1... (5 Replies)
Discussion started by: martva
5 Replies
Login or Register to Ask a Question