The UNIX and Linux Forums  

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
How to combine 2 different files rdasari HP-UX 1 03-17-2008 02:19 PM
Need To Combine 2 Files goodmis Shell Programming and Scripting 4 02-21-2007 07:55 PM
combine two files fredao1 Shell Programming and Scripting 1 01-08-2007 06:29 PM
How to combine 2 files ravi.sadani19 Shell Programming and Scripting 2 07-12-2005 01:04 AM
how to combine two files tao UNIX for Dummies Questions & Answers 4 03-21-2002 07:38 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-28-2005
Registered User
 

Join Date: Nov 2005
Posts: 1
Combine 2 files

Some one plz give me the answer
we have 3 files 1 and 2 are given and we need to get 3 file by using some
trick

file_one.dat
AMITH
ARUN
ARVIND

file_two.dat (these are Variables)
X
Y
Z
and we need to write scirpt in file_two.data and
get the answer in file_three.dat as fallows
file_three.dat
X = "AMITH";
Y = "ARUN";
Z = "ARVIND";

some one plz help for geting this
Reply With Quote
Forum Sponsor
  #2  
Old 11-28-2005
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,016
nawk -f nekki.awk file_one.dat file_two.dat > file_tree.dat

here's nekki.awk:
Code:
FNR==NR { arr[FNR] = $0; next}
{
  printf("%s = \"%s\";\n", $0, arr[FNR])
}
Reply With Quote
  #3  
Old 11-30-2005
npn npn is offline
Registered User
 

Join Date: Nov 2005
Posts: 14
Arrow Merging contents of two files

Try this for merging as you have mentioned

pr -tm file_one.dat file_two.dat | awk '{print $1"=\""$2"\";"}' > file_three.dat
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 02:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0