2 Replies Latest reply: May 15, 2014 9:59 AM by Steve Caiels RSS

    Parse text file into multiple text files based on field value

    bgfh _

      Hopefully someone will be able to help me out here.  I am using Monarch V7 (Standard Edition).  I have a text file (report from a Unix based system) that lists invoice information for all of our customers.  Some invoices will span more than one page; however, most are only one page in length.  Each page has a heading section that lists the customer number, a page number, etc.  What I need to do in export each customer's invoice into its own file.  For example, if the invoice file contains invoices for 10 customers, the end result would be 10 files.  I also want the output files to have the same format as the input file.

       

      Is this possible?

       

      Is there a way to attach files?  If so, I can attach a sample data file.

        • Parse text file into multiple text files based on field value
          Grant Perkins

          Hi,

           

          This requirement sound like something that would be best done on a Unix system using a unix scripting program such as sed. If you have people with such skills around I would approach them. Since you wish to keep the format the same as the invoice my inclination is to say this is not really a Monarch function. (And I don't think the utilities - PREP and MSRP - would offer much for this purpose.

           

          There is a standard 'split' instruction in unix but it expects to create files of a certain nmber of lines. OK if an invoice is a page, not so good if it is a variable length. 'csplit' takes it a bit closer but I guess you would alos like to have control over the names of the files produced.

           

          As a user I know of these things but don't have the knowledge to code with them.   

           

          Various people have written utility programs for Windows machines, some of which are shareware. Their functions may not always give the flexibility you require. A quick search on the web turned up quite a few places to check out.

           

          Alternatively you might be able to get what you want using a macro through MS Word for example.

           

          Sorry not to be of more help but I hope these suggestions will give you some options to consider.

           

          Best regards,

           

          Grant

           

          Originally posted by bgfh:

          Hopefully someone will be able to help me out here.  I am using Monarch V7 (Standard Edition).  I have a text file (report from a Unix based system) that lists invoice information for all of our customers.  Some invoices will span more than one page; however, most are only one page in length.  Each page has a heading section that lists the customer number, a page number, etc.  What I need to do in export each customer's invoice into its own file.  For example, if the invoice file contains invoices for 10 customers, the end result would be 10 files.  I also want the output files to have the same format as the input file.

           

          Is this possible?

           

          Is there a way to attach files?  If so, I can attach a sample data file. /b[/quote]

          • Parse text file into multiple text files based on field value
            Steve Caiels

            Hi,

             

            I agree that this doesn't look like a job for Monarch - However, if this is a core function of your organisation, it would be worth looking at Monarch/ES.  This does exactly what you are looking for.

             

            Regards

            Steve