The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
combination of two commands nehaquick UNIX for Dummies Questions & Answers 3 02-01-2008 04:09 AM
Detecting a key combination mobile01 High Level Programming 11 12-22-2006 09:46 AM
awk and file combination sickboy UNIX for Dummies Questions & Answers 1 06-13-2005 09:02 PM
Combination Of commands rahulrathod UNIX for Dummies Questions & Answers 2 12-14-2004 07:32 AM
Partition combination gardarm Filesystems, Disks and Memory 3 03-14-2002 07:35 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-27-2006
ting123 ting123 is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 25
shell help - file combination

Dear all,

I have a question about merging multiple files to one.

For example, I have 4 files, named file_1, file_2, file_3 and file_4, they all have same line number, and only one word in each line. I want to combine these four files to one file, file_1 becomes the first column of the new file, and file_2 becomes the second column of the new file, and so on.

How can I use shell to do this?

Thanks in advance.
  #2 (permalink)  
Old 06-27-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Hmmm, sounds like homework. Look up the man page of paste.
  #3 (permalink)  
Old 06-28-2006
ting123 ting123 is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 25
Yeah, I forget the command "paste". Thanks. Before this, I used perl to instead of.
  #4 (permalink)  
Old 06-29-2006
marc marc is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 5
correct me if i am wrong......
cant we use a simple ">>" for merging the files
ex: cat file_2 >>file_1
  #5 (permalink)  
Old 06-29-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by marc
correct me if i am wrong......
cant we use a simple ">>" for merging the files
ex: cat file_2 >>file_1
You can. But the OP wanted file1, file2, file3, file4 to be merged into a single file. The resulting file should have a single line with 4 columns. The >> would merge it into 4 lines in the new file.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:59 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0