LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-23-2013, 11:51 PM   #1
SAAAD
LQ Newbie
 
Registered: Mar 2013
Posts: 14

Rep: Reputation: Disabled
Unhappy HELP! How to merge two files as column wise??


Hi,

Would you help me, plz!
I'm really new in Linux, and i am struggling in that 2 days ago
I need to merge 3 files in one file, BUT I want to display them as column!
How I can achieve that?

e.g:
File 1 contains:
1.
2.
3.

File 2 contains:
A
B
C

File 3 contains:
XX
XY
YX

to be in one file looks like this:
File 1 File 2 File 3
1. A XX
2. B XY
3. C YX
and if possible, how to make a header (Title) for each column?

Thanx
 
Old 03-24-2013, 12:34 AM   #2
SAAAD
LQ Newbie
 
Registered: Mar 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Tape command is not found in mine!

Ive tried Tape command, but its not found in my package!
what other options do we have?
 
Old 03-24-2013, 01:20 AM   #3
SAAAD
LQ Newbie
 
Registered: Mar 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
over 45!

Over 45 had been reviewed my Thread, But no answer yet!
 
Old 03-24-2013, 01:30 AM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Simply use:
Code:
~$ paste file1 file2 file3
OR,
~$ paste -d" " file1 file2 file3
Also check manual of paste cmd for additional options here.
 
Old 03-24-2013, 01:32 AM   #5
SAAAD
LQ Newbie
 
Registered: Mar 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
paste is invalid

paste is not valid,
its giving me that its not in the package!
 
Old 03-24-2013, 01:36 AM   #6
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Command paste is very basic and it should be there.
Code:
~$ which paste
Which OS you're using?
 
Old 03-24-2013, 01:47 AM   #7
SAAAD
LQ Newbie
 
Registered: Mar 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thumbs up Done!

It works, I was typing it wrong (past, instead of paste)..
sorry for that.

How about the columns Headings (Title)?
 
Old 03-24-2013, 01:53 AM   #8
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Just try this:
Code:
~$ echo -e "File1\tFile2\tFile3"; paste file1 file2 file3
OR
~$ echo -e "File1 File2 File3"; paste -d" " file1 file2 file3
 
Old 03-24-2013, 02:28 AM   #9
SAAAD
LQ Newbie
 
Registered: Mar 2013
Posts: 14

Original Poster
Rep: Reputation: Disabled
Thumbs up Awesome!

Thanx a lot...
 
Old 03-24-2013, 02:31 AM   #10
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Please Mark the thread as solved (option is under Thread Tools on top menu), if you think it has so.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Append output of a command in column wise manner shivaa Linux - Newbie 5 02-18-2013 03:43 AM
Merge two files with similar column entries pratapsingh Programming 18 04-10-2012 11:02 AM
how to merge multiple columns into one column linuxon Linux - Newbie 6 03-14-2012 12:17 PM
need help in bash scripting...need to arrange variables in column wise manya Programming 7 11-07-2009 02:54 AM
printing column wise bharatbsharma Programming 4 09-11-2008 12:00 PM


All times are GMT -5. The time now is 10:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration