Merging two files with merging line by line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Merging two files with merging line by line
# 1  
Old 06-08-2012
Java Merging two files with merging line by line

Hi,

I have two files and i want to merge it like,

file1.txt
---------
abc
cde
efg

file2.txt
-------
111
222
333

Output file should be,
--------------
abc
111
cde
222
efg
333

Please suggest. Thanks.
# 2  
Old 06-08-2012
Try:
Code:
paste -d '\n' file1.txt file2.txt

This User Gave Thanks to Scrutinizer For This Post:
# 3  
Old 06-08-2012
MySQL

Thanks a lot. It is working fine.
Timely help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Merging multiple lines into single line based on one column

I Want to merge multiple lines based on the 1st field and keep into single record. SRC File: AAA_POC_DB.TAB1 AAA_POC_DB.TAB2 AAA_POC_DB.TAB3 AAA_POC_DB.TAB4 BBB_POC_DB.TAB1 BBB_POC_DB.TAB2 CCC_POC_DB.TAB6 OUTPUT ----------------- 'AAA_POC_DB','TAB1','TAB2','TAB3','TAB4'... (10 Replies)
Discussion started by: raju2016
10 Replies

2. Shell Programming and Scripting

Help with merging data into single line.

Hi, My input is <message> looking for a big <message>Does fit my G74 laptop. Makes the 10 pound. <message> <message>This bag is the only one I could find to fit my awesome ASUS G74S. <message> <message> Great bag my only wish is that they had put a pocket in which to store and... (6 Replies)
Discussion started by: pamu
6 Replies

3. Shell Programming and Scripting

merging multiple lines into single line

Hi, 1. Each message starts with date 2. There is blank line between each message 3. Each message does not contain same number of lines. Any help in merging multiple lines in each message to a single line is much appreciated. AIX: Korn Shell Error log file looks like below. ... (5 Replies)
Discussion started by: bala123
5 Replies

4. Shell Programming and Scripting

Merging several line in one based on an occurrence

Hi, I try to gather several line in one based on the first column. For exemple : toto;1;2;3 toto;4;5;6 toto;7;8;9 etc... (Number of lines not predefined) ruru;a;b;c ruru;d;e;f ruru;g;h;i ... I'm trying to get : toto;1;2;3;4;5;6;7;8;9... ruru;a;b;c;d;e;f;g;h;i...Thank you. (2 Replies)
Discussion started by: xanthos
2 Replies

5. Shell Programming and Scripting

Small Help required for merging two files per line!!!

Hi Guys, Sorry to bother everyone again here, but I ran into a small problem that has been after me for some time now. I have a file called file1.txt and has following content - /folder1/fold/folder 10k /folder167fold/folder 10MB /folder2/fold/folder 10G etc.. etc.. ... (1 Reply)
Discussion started by: rockf1bull
1 Replies

6. Shell Programming and Scripting

merging line and adding number

I having file below o/p ibapp311dg,,20480,s,,,,,,,,, test,,20480,s,,,,,,,,, test,,20480,s,,,,,,,,, ibapp311dg,,20480,s,,,,,,,,, I want to to chk unique word line in the first field seperated by , as well as addup corressponding the number in field for each unique word like ibapp311dg... (8 Replies)
Discussion started by: tarunn.dubeyy
8 Replies

7. Shell Programming and Scripting

merging similar columns in a single line file

Hi Guys. I have tried the commands sort and join. But I couldn't able to to find the command for joining in a single line based on keys.My example inputs and outputs are like the following. Help would be appreciated.:D Input file a1tabXXXXXXX a2tabXXXXXXX a6tabYYYYYYYYY a71tabXXXXXXX... (7 Replies)
Discussion started by: repinementer
7 Replies

8. UNIX for Advanced & Expert Users

Merging two command into single line

1. du -sch int* | grep "total" | awk '{print $1}' first command result is 17K 2. echo "B" Result B i want the output is 17KB (2 Replies)
Discussion started by: kingganesh04
2 Replies

9. Shell Programming and Scripting

Merging previous line using sed

I've been trying to merge a previous line when I find a pattern using sed with no luck. Maybe someone can help me. I am trying to find </Endtag>. Once I find that, I want to merge the previous line with the current line. I can do it with the next line with using N in sed but not previous.... (6 Replies)
Discussion started by: quixoticking11
6 Replies

10. Shell Programming and Scripting

merging 2 files starting at the n'th line of the first file

Hi all, I wonder if anyone could help me: I want to merge 3 files together as shown below I've seen the post adding columns from 01-05-2002, 09:23 AM so know how to put 2 files together basically I want to take output file of 1st merge and merge it with a 3rd file but only start the... (2 Replies)
Discussion started by: olga
2 Replies
Login or Register to Ask a Question