Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Get selective columns from a dump file using MS DOS and make new dump  (Read 24171 times)

0 Members and 1 Guest are viewing this topic.

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: Get selective columns from a dump file using MS DOS and make new dump
« Reply #15 on: September 08, 2014, 12:28:32 PM »
Post the main batch file that you used and I bet you have something wrong in it.  Pretty sure you didn't copy the main batch file that Foxidrive posted.  If you just tried to edit the first one I posted then you are using the wrong code.

tanvir.khan

    Topic Starter


    Rookie

    • Experience: Beginner
    • OS: Windows 7
    Re: Get selective columns from a dump file using MS DOS and make new dump
    « Reply #16 on: September 08, 2014, 11:09:38 PM »
    Here are all the original files attached with this mail:

    Input File: 20140902_pps_BaseTab_133.txt  --FYI this file extension is .list; but I can't attach file with that extension, so changed to .txt
    Output File: SDP_DUMP.txt
    Parser File: Parser.bat
    Executable File: SDP_DUMP_EXECUTE.bat

    Please let me know what went wrong :(

    Thanks/Tanvir

    [attachment deleted by admin to conserve space]

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: Get selective columns from a dump file using MS DOS and make new dump
    « Reply #17 on: September 09, 2014, 06:06:00 AM »
    Pretty sure you didn't copy the main batch file that Foxidrive posted.

    This.  I can see the difference in your code tanvir.khan.

    Squashman



      Specialist
    • Thanked: 134
    • Experience: Experienced
    • OS: Other
    Re: Get selective columns from a dump file using MS DOS and make new dump
    « Reply #18 on: September 09, 2014, 06:23:30 AM »
    SDP_DUMP_EXECUTE.bat is not the same code as Foxidrive posted.

    tanvir.khan

      Topic Starter


      Rookie

      • Experience: Beginner
      • OS: Windows 7
      Re: Get selective columns from a dump file using MS DOS and make new dump
      « Reply #19 on: September 09, 2014, 06:32:45 AM »
      Sorry guys!! foxidrive, as you mentioned to use parse script and add an extra line in SDP_DUMP_EXECUTE.bat, then use Squashman code; I didn't change the below line which actually creating the problem:  :o

      Squashman: for /F "tokens=3,4,6 delims=|" %%G in (file.csv.tmp) do echo %%G^|%%H^|%%I>>newfile.txt
      foxidrive: for /F "tokens=3,4,6 delims=|" %%G in (file.csv.tmp) do >>newfile.txt echo %%~G^|%%~H^|%%~I

      Now it works absolutely fine. Big thanks to both of you (Squashman, foxidrive) guys for your continuous support.

      As you know I've to parse multiple files automatically; is it possible to use *_pps_* or *.list etc. so that I don't to change file name manually by opening the bat file each time.
      call Parser.bat "/i:|" "/o:|" <20140902_pps_BaseTab_133.list >file.csv.tmp

      Thanks/Tanvir

      Squashman



        Specialist
      • Thanked: 134
      • Experience: Experienced
      • OS: Other
      Re: Get selective columns from a dump file using MS DOS and make new dump
      « Reply #20 on: September 09, 2014, 06:36:46 AM »
      What I do at work is make the batch file accept cmd line arguments.  What is nice about this method is that you can use it from the command prompt or you can also use Windows Explorer to select the files you want to process and then drag and drop them onto the main batch file.

      The other option is too wrap your existing code inside another FOR cmd that will list the files you want to process.  This can used Wild Cards to select the files you want.

      tanvir.khan

        Topic Starter


        Rookie

        • Experience: Beginner
        • OS: Windows 7
        Re: Get selective columns from a dump file using MS DOS and make new dump
        « Reply #21 on: September 09, 2014, 07:01:23 AM »
        Hi Squashman:
        I think your second option is more convenient for me, at least I understood what you wanted to say; but I couldn't even understand your first point. :( Could you please help me with code or demonstration to implement the second option. :)

        Please help.

        Thanks/Tanvir

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Re: Get selective columns from a dump file using MS DOS and make new dump
        « Reply #22 on: September 09, 2014, 07:41:08 AM »
        Your SIG: By 2015 the number of mobile-devices will exceed the number of people.

        This surely includes every mobile device made by man - not the number that are currently in use.

        Apply the same count to Automobiles... I think it would be a huge number too. :)


        Squashman



          Specialist
        • Thanked: 134
        • Experience: Experienced
        • OS: Other
        Re: Get selective columns from a dump file using MS DOS and make new dump
        « Reply #23 on: September 09, 2014, 07:52:24 AM »
        This surely includes every mobile device made by man - not the number that are currently in use.

        Apply the same count to Automobiles... I think it would be a huge number too. :)
        What do we consider a mobile device?
        We could go all the way back to the original Walkman, Portable CD players, Boom Boxes, Electronic Games etc, etc...  Those were the mobile devices I used as a teenager.  When I was growing up I already had more mobile devices then all of my family combined.

        foxidrive



          Specialist
        • Thanked: 268
        • Experience: Experienced
        • OS: Windows 8
        Re: Get selective columns from a dump file using MS DOS and make new dump
        « Reply #24 on: September 09, 2014, 08:01:32 AM »
        What do we consider a mobile device?

        Hmm, good question.  A car is a mobile device too. :D

        tanvir.khan

          Topic Starter


          Rookie

          • Experience: Beginner
          • OS: Windows 7
          Re: Get selective columns from a dump file using MS DOS and make new dump
          « Reply #25 on: September 09, 2014, 08:03:13 AM »
          What are you guys talking about ::)

          foxidrive



            Specialist
          • Thanked: 268
          • Experience: Experienced
          • OS: Windows 8
          Re: Get selective columns from a dump file using MS DOS and make new dump
          « Reply #26 on: September 09, 2014, 08:19:07 AM »
          What are you guys talking about ::)

          Click on the quote link to see the sig from a post in this thread.

          tanvir.khan

            Topic Starter


            Rookie

            • Experience: Beginner
            • OS: Windows 7
            Re: Get selective columns from a dump file using MS DOS and make new dump
            « Reply #27 on: September 09, 2014, 10:03:00 AM »
            That isn't relevant with my problem. I need to parse multiple files instead of a single one

            call Parser.bat "/i:|" "/o:|" <20140902_pps_BaseTab_133.list >file.csv.tmp

            How can I call multiple files?  ???

            foxidrive



              Specialist
            • Thanked: 268
            • Experience: Experienced
            • OS: Windows 8
            Re: Get selective columns from a dump file using MS DOS and make new dump
            « Reply #28 on: September 09, 2014, 10:19:21 AM »
            Sorry to meander off topic re the SIG, it's just not very satisfying answering questions when the task changes, and you need to redo what has already been tested and completed.




            Geek-9pm


              Mastermind
            • Geek After Dark
            • Thanked: 1026
              • Gekk9pm bnlog
            • Certifications: List
            • Computer: Specs
            • Experience: Expert
            • OS: Windows 10
            Re: Get selective columns from a dump file using MS DOS and make new dump
            « Reply #29 on: September 09, 2014, 11:11:53 AM »
            Foxidrive
            Your frustration is understandable.
            This post got my attention because the op seem to be introducing new parameters into the problem, as if this were a chat room or classroom discussion and not a form.
            Whenever anyone post a problem in this section, it needs to be clearly stated. often a clear, concise statement of power problem. i'll be solved is the key to providing a quick and accurate solution.
            Sometimes it helps if the poster will outline his problem in a pseudo-language that is close to the way we naturally speak.
            Something like this. perhaps.

            Open up some kind of file lists of a bunch of files that need to be processed.
             Begin the outer loop of the file list.
              Open up some kind of file from the next item in the list
              Open up some kind of file for the output of an input file.
              Read in one line from the input file.
              Examine the line to find the first item we want and send it to the output file
              Do the same for the next item.
              And again from the next item.
              Bump up to the input line.
             If at the end of the file close both files.
             Bump up to the next file in the list.
            If we get to the end of the list, quit the job.
            Otherwise repeat.

            Of course, that is not usable code, but it does describe the idea of having a list of files and reading input from each file and doing a process and sending it to an output. the type of file reading that you could do in dos is called stream editing. there is no provision in dos for reading an entire column of text from a file that is organized into columns. so you just have to do it line by line.
            This is given only asset suggestion. it is much better to have a verbose description in the first post rather than going on on and adding more information to the problem on-the-fly.
            Well, that's what i think. if anybody knows what better way to solve problems, please speak up and say something.

            « Last Edit: September 09, 2014, 12:04:47 PM by Geek-9pm »