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 > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
merge files koti_rama Shell Programming and Scripting 5 12-24-2007 10:59 PM
use of sed over cat to merge files miwinter UNIX for Advanced & Expert Users 2 11-28-2007 01:36 PM
How to merge files lestat_ecuador Shell Programming and Scripting 3 06-07-2007 06:45 AM
help in merge files u263066 Shell Programming and Scripting 5 07-24-2006 03:24 AM
Using NAWK to merge two files madhunk Shell Programming and Scripting 7 06-07-2006 10:27 AM

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 02-12-2008
fedora fedora is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 94
how to merge these two files?

I have two files, each of them has 12 lines, fileA has 3 columns, fileB has 1 column, like the following

FileA

a 1
b 2
c 3
..blabla

FileB
A
B
C
..blabla

Now I am trying to put the content of fileB as column 3 of fileA, e.g.

a 1 A
b 2 B
c 3 C
...blahblah

I figure there should be a simple unix command can be used to do this, am I right?
  #2 (permalink)  
Old 02-12-2008
MaestroRage MaestroRage is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 20
quite right, paste should do it.

paste FileA FileB will give you the desired output.

paste FileB FileA will reverse it.
  #3 (permalink)  
Old 02-12-2008
fedora fedora is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 94
wow, this is great!

I am reading manpage of paste, but not quite understand what does "-" do,

why

ls| paste -d" " -

lists a dir in one column?



Quote:
Originally Posted by MaestroRage View Post
quite right, paste should do it.

paste FileA FileB will give you the desired output.

paste FileB FileA will reverse it.
  #4 (permalink)  
Old 02-12-2008
bobbygsk bobbygsk is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 90
I responded with an answer but I misunderstood the question.
I'm taking back my answer. I did not see any option to delete my message
So edited my message

Last edited by bobbygsk; 02-12-2008 at 06:53 PM..
Sponsored Links
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 10:50 AM.


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