Suggestion for software, please.

Discussion in 'Application Software' started by RawData, Jul 30, 2012.

  1. RawData

    RawData MDL Member

    Mar 4, 2008
    223
    30
    10
    #1 RawData, Jul 30, 2012
    Last edited by a moderator: Apr 20, 2017
    I need to pick and convert information form XML file. Manually it's too tedious job, so perhaps regular brainiacs :worthy: here could suggest suitable software for the job?

    The source file contains this kind of information (address replaced with example.com):
    Code:
    <item><date>Wed, 11 Jul 2012 21:47:08 +0300</date><taskuid>269124407.11</taskuid><task>Get new email from example.com</task><server>example.com</server><message>Server example.com: No response from server (timeout).</message></item>
    
    This is the part I need to get:
    Code:
    <date>Wed, 11 Jul 2012 21:47:08 +0300</date>
    This is the format I would like to convert it, if possible:
    11 Jul 2012, 21:47:08

    The idea of it is to make a graph later to visualize the ADSL line disconnections I'm experiencing. Just to make it easier to see how those disconnections relate to other factors.

    The thing is, my internet connection has been crappy almost 3 months now and without more cleas the local operator nor even my ISP are unwilling to do anything without more clues to pinpoint the problem. Personnally, I think I know were the problem is and how to fix it, but no amount of explaining seems to make them even try to fix this properly.

    Please, no suggestion to change ISP. The main problem is local operator, as it also works as an ISP here. No wonder why they are not so eager to fix this, eh? o_O
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. urie

    urie Moderator
    Staff Member

    May 21, 2007
    9,039
    3,388
    300
    What about Notepad++ it has it has macro functions.
     
  3. RawData

    RawData MDL Member

    Mar 4, 2008
    223
    30
    10
    Allthought it's a wonderful piece of software, I can't make it to do heads or tails. It was the first thing I tried and I was so full of fail. :aglerks:

    Maybe I can find stone age QEdit for DOS from somewhere, as it suits my age better. And I know how I could do the job manually with it. well, mostly. :eek:

    I searched few hours and tried numerous converters. None of them were even remotely suitable.
    I'll better try again with NP++ again, as it looks like there is no better options.

    I may have bitten more than I can chew at the moment. Processing manually converted file did not result the expected nice graph.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. 100

    100 MDL Expert

    May 17, 2011
    1,347
    1,575
    60
    #4 100, Jul 31, 2012
    Last edited by a moderator: Apr 20, 2017
    PowerShell script:
    Code:
    $xml = [xml](gc c:\file.xml)
    $xml | Select-Xml '//item/date' |% { [DateTime]::ParseExact($_.Node.InnerText, "ddd, d MMM yyyy H:mm:ss zzz", [Globalization.CultureInfo]::InvariantCulture).ToString("dd MMM yyyy, HH:mm:ss") }
    
    Change the highlighted parts for your input file, or to customize the output format.

    Note that this will also parse the time zone (GMT +3 in the example string), so in case you have a different one set on your machine the output times will be converted to that time zone.
     
  5. RawData

    RawData MDL Member

    Mar 4, 2008
    223
    30
    10
    #5 RawData, Aug 13, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    I appreciate your help and will save this, in case I have to do this again with longer log. I took the short (about 500 lines) file and handed it to a friend, who manually converted the data. It cost me a bit more than dinner and a promise not to make her ever to do such job again, so this might come handy later. However, there were not enough data to make any valid conclusions, so the problem is not solved yet. Yesterday, no connection problems. Today, looks bad. I still think it's all because of interference between two ADSL connections.

    One thing is clear. If I'm to benefict about your helpfulness, I may have install the cursed PowerHell... :D

    Thank you. :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...