writing the content of two files to a single file horizontally


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting writing the content of two files to a single file horizontally
# 1  
Old 03-15-2011
writing the content of two files to a single file horizontally

Hi all,

assume that i am having two files file.1 and file.2

these are the contents of file.1

Quote:
Dinesh
Ganesh
Anish
Dev
Jagan
Gopi
these are the contents of file.2

Quote:
admin
engineer
ceo
doctor
press
operation
i want these two contents to be written in another single file like this.

Quote:
Dinesh admin
Ganesh engineer
Anish ceo
Dev doctor
Jagan press
Gopi operation
can you please post your suggestions.

Thanks in advance,
Anish
# 2  
Old 03-15-2011
Check out the paste command.
# 3  
Old 03-15-2011
Hi,

use the following command for this in this given formate.
Code:
paste file1 file2 > file3

file3 is the correct file of your requirement.

regards
rajesh

Last edited by radoulov; 03-15-2011 at 12:15 PM.. Reason: Code tags, please!
This User Gave Thanks to rajesh_pola For This Post:
# 4  
Old 03-15-2011
Hi,

Thanks that works
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Content of file in single line

Hi I want to create output file which is having entries from source file in single line a.txt <output type="event"> <moduleId>abc</moduleId> <errorCode>963016</errorCode> <text>Test1</text> </output> ... (2 Replies)
Discussion started by: aaysa123
2 Replies

2. Shell Programming and Scripting

Paste 2 single column files to a single file

Hi, I have 2 csv/txt files with single columns. I am trying to merge them using paste, but its not working.. output3.csv: flowerbomb everlon-jewelry sofft steve-madden dolce-gabbana-watchoutput2.csv: http://www1.abc.com/cms/slp/2/Flowerbomb http://www1.abc.com/cms/slp/2/Everlon-Jewelry... (5 Replies)
Discussion started by: ajayakunuri
5 Replies

3. Shell Programming and Scripting

Merging data horizontally with newlines in files

Hi Everyone, I have two files file1 and file2 with these contents cat file1 AAAAA 01/03/2014 04:01:23 BBBB 01/03/2014 03:03:34 CCCcc 01/03/2014 03:03:34 cat file2 1 RED 1 HHHH 1 TTTT 1 BBBBB I tried the below... (2 Replies)
Discussion started by: Aditya_001
2 Replies

4. Shell Programming and Scripting

Adding content of two file in a single file column wise

Hi, I am trying to get the file in particular pattern using shell script. I have to add one column to some other file. For example consider two file as below. File1: name1 name2 name3 File2: Add1 age1 Add2 age2 Add3 age3 I want this two file in a single file format something like... (3 Replies)
Discussion started by: diehard
3 Replies

5. Shell Programming and Scripting

search for content in files. Name of files is in another file. Format as report.

Hi I have multiple files in a folder and one file which contains a list of files (one on each line). I was to search for a string only within these files and not the whole folder. I need the output to be in the form File1<tab>string instance 2<tab> string instance 2<tab>string instance 3... (6 Replies)
Discussion started by: pkabali
6 Replies

6. Shell Programming and Scripting

Writing content into a file

Hi.. I have some content as Hello how are you? Where are you? i need the above content to be placed in a file called hello.sh So,when i execute a file called hi.sh it should automatically create the file hello.sh and write the above content into it. I know to create a file using touch... (4 Replies)
Discussion started by: krthik
4 Replies

7. Shell Programming and Scripting

Need help in reading a file horizontally and printing vertically

Hi Every body, I have file which has enttries, with each 5 entries as a set of entries, I would like to read the file (line by line) and print five entries of a set vertically, the next entry should come in the next line. Example: cat sample_file I am a Unix Adminsitrator new to shell... (6 Replies)
Discussion started by: aruveiv
6 Replies

8. Shell Programming and Scripting

merge two files horizontally

Hi all, I have two files -- one with 1024 lines and another with 2048 lines. I want to merge them to create another file in such way that it takes 2 lines from file with 1024 lines and 4 from 2048 lines. I wrote a sample script and curious to see if there is a better way; i am sure there is,... (4 Replies)
Discussion started by: jakSun8
4 Replies

9. HP-UX

Combining files horizontally

I have 2 files, 1.txt and 2.txt which have the following format: 1.txt :451:1 :451:0 :451:1 and so on.. 2.txt :108:13897187 :108:90890789 :108:76476386 and so on.. I want to combine the files horizontally, I tried paste 1.txt 2.txt as well as cat but both of them are giving me... (3 Replies)
Discussion started by: anshuljain
3 Replies

10. UNIX for Advanced & Expert Users

Merging Two File Horizontally

I am trying to merge two large file horizontally using paste command. Every thing is working fine except for time. Its taking lot of time. Is there any effiecient way of doing the same thing or is there anyway by which I can improve its perfomance programatically? Thanks, Yeheya (1 Reply)
Discussion started by: yeheyaansari
1 Replies
Login or Register to Ask a Question