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
how to merge these two files? fedora Shell Programming and Scripting 3 02-12-2008 06:45 PM
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

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 08-24-2007
nvkuriseti nvkuriseti is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 7
merge two files in one file

All,

I've basic knowlege on understanding UNIX Shell Programming. Right now I need to write a script for the following requirement. Kindly help me or suggest me how to write a Shell script.

I've 8 .csv files that are containing "Detail" records. Each file getting more than 1 million. Another eight files (.csv) are containing only one "Header" in each file. Now I want to MERGE these <Header> and <Detail> records in one file in the below format:

tstVenkat1.csv
This is Header Record
This is Detail Record
This is Detail Record
.
.
.
.
tstVenkat8.csv
This is Header Record
This is Detail Record
This is Detail Record

For <Header> record the file naming convention as tst1Venkat.xml and for <Detail> records the file naming convention as tstVenkat1.xml

From the above, want to send tst1Venkat.xml (ie., Detail records) to tstVenkat1.xml (ie., Header record containing here and it must be the first line in this file).

Kindly help to write in a shell script.

Thank you!
- Venkat
  #2 (permalink)  
Old 08-24-2007
vishalzone2002 vishalzone2002 is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 13
either i didnt got ur problem rite or it doesnt need any script

try this

cat testvenkat1.xml >> test1veknat.xml
  #3 (permalink)  
Old 08-24-2007
ahmedwaseem2000 ahmedwaseem2000 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Bangalore
Posts: 219
Please provide more examples.

here is the code to concat the files:

Code:
 cat file1 file2 file3 >> Outputfile
  #4 (permalink)  
Old 08-27-2007
sagarhebra sagarhebra is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 1
Thumbs up

cat <<header file>> <<detail file>> > <<new file>>
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 04:55 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