Concatenate a file with another file.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Concatenate a file with another file.
# 1  
Old 11-26-2006
Concatenate a file with another file.

Hi All,
I have a problem in concatenate a file with another file.
The problem is as below:

I have a file with three columns and 7 rows. This is the first file and all separated by tab delimited format.

The second file has 8 colunms and 7 rows. And also separated by tab delimited format.
So now I need the first file with three colunms to come first and than the second file with 8 columns and make a third file of total 11 colunms and 7 rows.

Can any one have any inputs....Its needed in a reporting application.
Thanks in advance...To all masterminds....
# 2  
Old 11-27-2006
look into 'man paste'
# 3  
Old 11-27-2006
Quote:
Originally Posted by vgersh99
look into 'man paste'
Hi vgersh,
Thanks for you input but can you give example!!!!
Like taking two files as input and puting the output of the two into a third file.

I have tried the same but not able to do the same....

It will be helpful if you can do that a simple example...

Thanks and Regards,
Soumya
# 4  
Old 11-27-2006
There have been so many posts describing the usage of paste Smilie

> cat a
1 2 3
4 5 6


>cat b
a b c d e
a b c d e

>paste -d" " a b
1 2 3 a b c d e
4 5 6 a b c d e


-d is for delimiter, change accordingly for your case
# 5  
Old 08-09-2008
Thanks

Thanks...just what i was looking for Smilie
# 6  
Old 05-21-2009
How to concatenate two files at a specific column

Hi

I have two files, one is 1.6 GB, I would like to add one extra column of information to the large file at a specific location. After the 3rd column.

For example:

File 1 has two columns more than 1000 rows like this

MM009987 1

File 2 has dozens of columns like this

MM00098 MM00076 3 4 2 4 2 1 3

I would like to add the 2nd column from File 1 to File 2 after column 3

Thank you for any help on this
# 7  
Old 05-21-2009
this is an old thread.

you said the one of the file is 1.6GB, and file 1 has only more than 1000 rows. So how's it going to look like after the 1000th line of your big file when you have inserted those 1000++ 2nd columns into it?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read and concatenate content file and file name

Hi all, i need a bash script. I have a 3 file named Milano, Torino, Firenze Into file i have: Milano Marco Luca Giorgio Michele PatrizioTorino Marco Giulio Emilio MicheleFirenze Luca Giorgio Marco Saverio EmilioThe output should be a all_city.csv file like: (3 Replies)
Discussion started by: kamose
3 Replies

2. Shell Programming and Scripting

Concatenate text file

I have a text file in the below format: chr1 10002681 10002826 LZIC chr1 10002980 10003083 NMNAT1 chr1 10003485 10003573 NMNAT1 chr1 100111430 100111918 PALMD chr1 100127874 100127955 PALMD chr1 100133197 100133322 PALMD chr1 100152231 100152346 PALMD chr1 100152485 100152519 PALMD... (8 Replies)
Discussion started by: cmccabe
8 Replies

3. Shell Programming and Scripting

Concatenate two columns in a file

Hi i am having one requirement like to concatenate two columns in to one columns, can any one help on this please sample scenario i am placing below COL1,COL2,COL3,COL4 1,A,B,C,D 2,e,f,g,h ouput should be 3 columns like below. COL1,COL2,newcolumns 1,A,B,CD 2,e,f,gh ... (9 Replies)
Discussion started by: bhaskar v
9 Replies

4. Shell Programming and Scripting

concatenate multiple file

Hi Need some help to concatenate files I have multiple spool files nearlly 15 of them which I need to concatenate like as shown in the below example for ex. file1.txt aaaa|bbbbb|cccc| dddd|eeee|ffff| kkkkk|uuuuu|gggg| file2.txt xxxx|yyyy|zzzz| 1111||kkkk|lllll... (2 Replies)
Discussion started by: rashmisb
2 Replies

5. Programming

Concatenate two lines in a fIle

Hi All, Can any one help me in finding the solution for concatenating two or more lines in a file and writing them to a temporary file. for Example: He is a wise student. So he got first rank. This is in a file i want the output as He is a wise student so he got first rank. into a file... (3 Replies)
Discussion started by: uday.sena.m
3 Replies

6. Shell Programming and Scripting

Concatenate strings retrieved from a file and write it into another file

Hi, I have a file files.txt containing data as below: abc;xyz uvw;pqr 123;456 I want to develop strings like below using the above data and write them into another file: www/xxx/abc/yyy/xyz www/xxx/uvw/yyy/pqr www/xxx/123/yyy/456 All this needs to be done through .sh file. ... (4 Replies)
Discussion started by: archana.n
4 Replies

7. Shell Programming and Scripting

Insert file names when concatenate files into a file

Hi I found the following line would concatenate all test_01 test_02 test_03 files into "bigfile". cat test_* >> bigfile But, what I'm looking for a way to insert each file names in order when concatenated in "bigfile". Thank you samky2005 (2 Replies)
Discussion started by: samky2005
2 Replies

8. Shell Programming and Scripting

concatenate all duplicate line in a file.

Hi All, i have a zip file like the format 794051400123|COM|24|0|BD|R|99.98 794051413727|COM|11|0|BD|R|28.99 794051415622|COM|23|0|BD|R|28.99 883929004676|COM|0|0|BD|R|28.99 794051400123|MOM|62|0|BD|R|99.98 794051413727|MOM|4|0|BD|R|28.99 794051415622|MOM|80|0|BD|R|28.99 ... (30 Replies)
Discussion started by: vaskarbasak
30 Replies

9. UNIX for Dummies Questions & Answers

Concatenate date to file name

Hi, I have written a script to rename a file, but I can not add the current date (in YYYYMMDD-HHMM format) can you please look at this cript, and help? thanks, #!/usr/local/bin/tcsh -f set server = "$1" set user = "$2" if (-f $server) then \mv $server $server.Saar. endif (4 Replies)
Discussion started by: sierra_aar
4 Replies

10. UNIX for Dummies Questions & Answers

file Concatenate

Hi All, I have a question about file concatenate on unix. I have two file 1 of them like aaa,bbb,ccc,ddd other one is eee,fff,ggg,hhh I want to concatenate those file like this position aaa,bbb,ccc,ddd,eee,fff,ggg,hhh how can I do this ?? thanks. Alice (3 Replies)
Discussion started by: alisev
3 Replies
Login or Register to Ask a Question