Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

how to combine two files into one file using shell scrip

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 12-06-2010   -   Original Discussion by netbanker
netbanker's Unix or Linux Image
netbanker netbanker is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 23 February 2016, 6:09 PM EST
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
how to combine two files into one file using shell scrip

eg.
file 1 has:


Code:
4  0 8628380 653253   0   0   0   0    0   0 
 2  0 8626407 655222   0   0   0   0    0   0 
 4  0 8633729 647892   0   0   0   0    0   0 
 5  0 8646253 635367   0   0   0   0    0   0

file 2 has:


Code:
4798 48717 11554 
5408 56487 14359 
6010 58415 15220 
5541 41044 12675


I want to make a file 3 like: ( appending each line of file2 in file1 )


Code:
4  0 8628380 653253   0   0   0   0    0   0 4798 48717 11554 
 2  0 8626407 655222   0   0   0   0    0   0 5408 56487 14359 
 4  0 8633729 647892   0   0   0   0    0   0 6010 58415 15220 
 5  0 8646253 635367   0   0   0   0    0   0 5541 41044 12675

any advice will be highly appreciated.
Moderator's Comments:
how to combine two files into one file using shell scrip Please use code tags when posting data and code samples!

thanks~

Last edited by vgersh99; 12-06-2010 at 06:42 PM.. Reason: code tags, please!
Sponsored Links
    #2  
Old Unix and Linux 12-06-2010   -   Original Discussion by netbanker
cabrao's Unix or Linux Image
cabrao cabrao is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 15 April 2013, 7:39 AM EDT
Posts: 201
Thanks: 37
Thanked 24 Times in 24 Posts

Code:
paste file1 file2

The Following User Says Thank You to cabrao For This Useful Post:
codecaine (12-06-2010)
Sponsored Links
    #3  
Old Unix and Linux 12-06-2010   -   Original Discussion by netbanker
netbanker's Unix or Linux Image
netbanker netbanker is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 23 February 2016, 6:09 PM EST
Posts: 23
Thanks: 0
Thanked 1 Time in 1 Post
looks good, Thanks Cabrao~
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to convert shell scrip to binaric command raghunsi UNIX for Advanced & Expert Users 1 02-03-2010 02:27 AM
combine 3 excel files using shell. radhika Shell Programming and Scripting 11 05-06-2009 07:18 AM
Combine file using shell script justbow Shell Programming and Scripting 1 02-10-2009 03:48 AM
combine text files into one file zzthejimzz UNIX for Dummies Questions & Answers 3 11-06-2008 02:24 AM
Using cp command inside shell scrip yoavbe Shell Programming and Scripting 2 06-22-2006 10:57 AM



All times are GMT -4. The time now is 06:18 AM.