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

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 Rate Thread Display Modes
  #1 (permalink)  
Old 11-28-2005
Nekki Nekki is offline
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
  #2 (permalink)  
Old 11-28-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
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])
}
  #3 (permalink)  
Old 12-01-2005
npn npn is offline
Registered User
  
 

Join Date: Dec 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
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:30 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