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
merging two files rameshonline Shell Programming and Scripting 14 04-06-2009 01:20 AM
merging of 2 files AWK, SHELL or something else klut Shell Programming and Scripting 24 03-20-2009 09:45 AM
Merging 2 .CSV files in Unix chachabronson UNIX for Dummies Questions & Answers 6 08-05-2008 03:11 AM
merging of 2 files AWK - part 2 pp56825 Shell Programming and Scripting 2 02-11-2008 10:14 PM
Merging two files venommaker UNIX for Dummies Questions & Answers 4 01-10-2008 08:15 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 4.00 average. Display Modes
  #1 (permalink)  
Old 01-24-2005
ppass's Avatar
ppass ppass is offline
Registered User
  
 

Join Date: Jan 2005
Posts: 93
merging colums from different files

hi all ,

i have three files that contain numbes as the first column .
i want to add these files together so the numbers from the first file is in the first column ; the numbers from the second file in the second column; and the numbers from the third file in the third column .


as an example :

file1 file2 file3
12 23 236
13 234 234
134 233 234
14 237 233
14 2367 232
14 2399 232



file 4
12 23 236
13 234 234
134 233 234
14 237 233
14 2367 332
14 2399 232

thank in advance
  #2 (permalink)  
Old 01-24-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
This sounds like it could be a homework problem. If it is, please read the rules. If it isn't, please let us know what you've tried so far, and what specific problem you're having.

Thanks,
ZB
  #3 (permalink)  
Old 06-15-2006
Love's Avatar
Love Love is offline
Registered User
  
 

Join Date: May 2006
Location: Bangalore, Karnataka, INDIA.
Posts: 21
Thumbs up Useful help

Sorry friends,

Even Im also trying for the same things,

Actually I have 4 report files each contains Jobs name, order date, run date and status. I have to generate one resultant report which looks to be:


job name Order date run date status

I've tried to select each column values into seperate variables and used echo.

echo "$var1\t" >> result.report
echo"$var2\t" >> result.report
echo "$var3\t" >> result.report
echo "$var4\n" >> result.report


It is working well but I want to know are there any ways to achieve this?

Your help will be appreciated.

Many Thanks and Regards.

Love
  #4 (permalink)  
Old 06-16-2006
Raom Raom is offline
Registered User
  
 

Join Date: Sep 2005
Location: india
Posts: 79
have u tried using paste command
paste f1 f2
  #5 (permalink)  
Old 06-16-2006
prajith78 prajith78 is offline
Registered User
  
 

Join Date: Jun 2006
Location: Bangalore, India
Posts: 8
hey raom,

thanks for introducing 'paste'. its new for me.

regards
prajit
  #6 (permalink)  
Old 06-19-2006
msridh msridh is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 4
Hi,

Try this way...

Let us say, your data is in file1 file2 file3 and file4.

--------------------------------------------------------------------------
#!/bin/ksh

rm a1 b1 c1 d1

cat file1 | while read record
do
echo $record | cut -d" " -f1 >> a1
done

cat file2 | while read record
do
echo $record | cut -d" " -f1 >> b1
done

cat file3 | while read record
do
echo $record | cut -d" " -f1 >> c1
done

cat file4 | while read record
do
echo $record | cut -d" " -f1 >> d1
done

paste a1 b1 c1 d1
--------------------------------------------------------------------------

Best Regards,
Sridhar M

Quote:
Originally Posted by ppass
hi all ,

i have three files that contain numbes as the first column .
i want to add these files together so the numbers from the first file is in the first column ; the numbers from the second file in the second column; and the numbers from the third file in the third column .


as an example :

file1 file2 file3
12 23 236
13 234 234
134 233 234
14 237 233
14 2367 232
14 2399 232



file 4
12 23 236
13 234 234
134 233 234
14 237 233
14 2367 332
14 2399 232

thank in advance
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 08:51 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