Unix/Linux Go Back    


Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

How join two xml files?

Windows & DOS: Issues & Discussions


Closed    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 06-11-2016
Tapiocapioca Tapiocapioca is offline
Registered User
 
Join Date: Jun 2016
Last Activity: 23 April 2017, 4:07 AM EDT
Posts: 17
Thanks: 10
Thanked 0 Times in 0 Posts
I tried to find what you told me, but I can't find it. Here there is the list of the possible command hxxp://gnuwin32.sourceforge.net/packages.html I think what you told me is no available Linux

---------- Post updated at 04:20 PM ---------- Previous update was at 04:18 PM ----------

Quote:
Originally Posted by Aia View Post
Do you have Perl?


Code:
my $header = qq(<?xml version="1.0" encoding="UTF-8"?>);
my @tv_queue;
my %tv = ();
{
    local $/="</tv>\n";
    while(<>) {
        my ($generator) = /(<tv.*>)/;
        if (!$tv{$generator}){
           push @tv_queue, $generator;
        }
        push @{$tv{$generator}[0]}, /(\s{2}<channel.*channel>)/sm;
        push @{$tv{$generator}[1]}, /(\s{2}<programme.*programme>)/sm;
    }
}
print "$header\n";
for my $g (@tv_queue){
    print "$g\n";
    for my $i (@{$tv{$g}}) {
        print join("\n", @{$i}), "\n";
    }
    print "</tv>\n";
}

I have not but i think is avalaible, I try to find and install it.
Sponsored Links
    #9  
Old Unix and Linux 06-11-2016
Aia's Unix or Linux Image
Aia Aia is offline
Registered User
 
Join Date: May 2008
Last Activity: 26 April 2017, 6:07 PM EDT
Posts: 1,540
Thanks: 43
Thanked 585 Times in 550 Posts
Quote:
Originally Posted by Tapiocapioca View Post
I have not but i think is avalaible, I try to find and install it.
There are binaries of Perl for windows as well.
Sponsored Links
    #10  
Old Unix and Linux 06-11-2016
Tapiocapioca Tapiocapioca is offline
Registered User
 
Join Date: Jun 2016
Last Activity: 23 April 2017, 4:07 AM EDT
Posts: 17
Thanks: 10
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Aia View Post
There are binaries of Perl for windows as well.
I found and downloaded this hxxp://www.activestate.com/activeperl/downloads , but I am totally beginner about, what the way to use your script? Where can I input my files? Excuseme if I am asking really simple questions for you totally clear.
    #11  
Old Unix and Linux 06-11-2016
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is online now Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 1 May 2017, 1:53 AM EDT
Location: San Jose, CA, USA
Posts: 10,225
Thanks: 514
Thanked 3,550 Times in 3,023 Posts
Moderator's Comments:
How join two xml files? I am moving this out of the Shell Programming and Scripting forum to the Windows & DOS: Issues and Discussions forum.

This question is asking about creating and running batch commands on a Windows system where the batch command runs some unspecified subset of GnuWin packages tools not including the package that contains the shell.

Maybe someone with more knowledge of Windows batch scripting can tell you how to do what you want using Windows commands.
Sponsored Links
    #12  
Old Unix and Linux 06-11-2016
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 30 April 2017, 2:00 PM EDT
Location: Aachen, Germany
Posts: 10,707
Thanks: 264
Thanked 3,289 Times in 3,029 Posts
Tell us a bit more about that Italy - Indonesia setup. Are both machines Windows? How do you connect/login? Is there an option to copy those files elsewhere?
Sponsored Links
    #13  
Old Unix and Linux 06-11-2016
Tapiocapioca Tapiocapioca is offline
Registered User
 
Join Date: Jun 2016
Last Activity: 23 April 2017, 4:07 AM EDT
Posts: 17
Thanks: 10
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by RudiC View Post
Tell us a bit more about that Italy - Indonesia setup. Are both machines Windows? How do you connect/login? Is there an option to copy those files elsewhere?
I use remote desktop to connect to one machine with windows 7, is a real machine not virtual. I connect mysel from indonenesia to italy, but I think this is not really important Linux I tried to make some scripts with dos but the xml files I need edit are big like 100 mb and windows become crazy trying to modify big files, so I tried the solution of GnuWin32 Packages and works fine. But about join files with linux command I have not idea Linux
Sponsored Links
    #14  
Old Unix and Linux 06-11-2016
Aia's Unix or Linux Image
Aia Aia is offline
Registered User
 
Join Date: May 2008
Last Activity: 26 April 2017, 6:07 PM EDT
Posts: 1,540
Thanks: 43
Thanked 585 Times in 550 Posts
Quote:
Originally Posted by Tapiocapioca View Post
I found and downloaded this hxxp://www.activestate.com/activeperl/downloads , but I am totally beginner about, what the way to use your script? Where can I input my files? Excuseme if I am asking really simple questions for you totally clear.
Save the snippet I posted as merge_xml.pl
Run at the command prompt as perl merge_xml.pl file1.xml file2.xml file3.xml > big.xml

This suggested code will accommodate as many files as you want to merge. It uses the following entries as unique ID

Code:
<tv generator-info-name="xxx" generator-info-url="www.xxx.com">

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
Splitting a single xml file into multiple xml files Narendra921631 Shell Programming and Scripting 3 03-03-2016 02:50 PM
Extract strings from XML files and create a new XML milano.churchil Shell Programming and Scripting 12 06-22-2015 06:25 AM
How to use the the join command to join multiple files by a common column evelibertine UNIX for Dummies Questions & Answers 5 07-05-2012 04:15 PM
how to join two files using "Join" command with one common field in this problem? mindfreak UNIX for Dummies Questions & Answers 2 04-13-2012 05:55 AM
Join 2 files with multiple columns: awk/grep/join? InfoSeeker UNIX for Dummies Questions & Answers 3 12-01-2009 07:45 PM



All times are GMT -4. The time now is 02:14 AM.