Menu

Support footer rows in ascii file

Help
Anonymous
2004-09-08
2004-09-10
  • Anonymous

    Anonymous - 2004-09-08

    A modified question.

    I have a ascii data file with 1 line of header and 1 line of trailer - the 1st line and the LAST line in the data file.  These 2 lines do not have any specific value to distinguish from them.

    The lines in between are the data rows, with fixed-length columns.

    Thus, I cannot use segmented-line method to parse this file.  But I cannot find a way to include a trailer, and to handle fixed-length columns.

    Can anyone help to provide a solution?  Thanks.

     
    • bruce mcdonald

      bruce mcdonald - 2004-09-09

      The big question is:  how do you know that you have reached the trailer?  Do you simply count the paragraphs and when they reach some defined number, then the next paragraph, line is the trailer?

      Answer this and we can look into solutions.

       
    • Anonymous

      Anonymous - 2004-09-09

      How do I know I have reached the trailer?

      The LAST line is the trailer.  There is NO specific pattern in the trailer line that tell us it is the trailer.  But the LAST line in the data file is the trailer.

      Let's see the sample data file:

      ###20040901020142XXXXXX
      Record 1This is the 1st record
      Record 2This is the 2nd record
      .............(repeat)..................
      Record N This is the Nth record
      ###00000N

      You can see that the 1st line is the header line with a timestamp field and other info as well.

      The LAST line is the trailer with a total number of record field, for verification.

      Since both the header and trailer has the same pattern (###), and NO pattern for data lines, we cannot use the segmented-line method.

      Any idea?

       
      • bruce mcdonald

        bruce mcdonald - 2004-09-10

        Is N a fixed or known number?

        Otherwise you can just do this by making a XSL that swallows the last line.

         
    • Anonymous

      Anonymous - 2004-09-10

      N is neither fixed or known.

      So there is no direct support to handle this case.  I will try to use XSL to solve this.

      Thanks very much.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.