in reply to create a level csv

Perhaps you could add an explanation of your goal, "in words"? The output listing you've provided shows us what the output looks like, but not what it means. It looks like you might be counting something, but at present the only way anyone can know your goal is to read your code.

I'm sure you'll agree that reading your code may not be a very reliable way of understanding your goal, given that right now your code isn't doing what you want.

Best, beth

Replies are listed 'Best First'.
Re^2: create a level csv
by Paulux (Acolyte) on Apr 16, 2009 at 09:30 UTC
    Sorry for beeing late.I need an output like this:
    0 440Z0220-932吶ther information <-- this is the first line of the + "root file" 1 440Z0220-932吶ther information 1 623Z5400-1吶ther information 1 623Z5400-1吶ther information 1 623Z5400-18other information 1 623Z5400-18吶ther information 1 623Z5400-3吶ther information 1 623Z5420-1301吶ther information 1 623Z5420-1307吶ther information 1 7010902H01吶ther information 1 7010900H01other information 1 623Z5466-1013吶ther information 1 623Z5466-1015吶ther information 1 623Z5465-1039吶ther information 1 623Z5465-1041吶ther information 1 623Z5465-1001吶ther information 1 623Z5420-3301吶ther information 1 623Z5465-41吶ther information 1 623Z5462-1001吶ther information <-- this is the line that has chil +dren of level 2 2 623Z5465-1吶ther information <-- this is the second line of the + 1_623Z5465-1001.CSV file 2 623Z5465-11吶ther information 2 CA623Z5465-1001吶ther information <-- and this is the last line of t +he 1_623Z5465-1001.CSV file 1 623Z5462-1003吶ther information <-- here i continue to read the "r +oot" file 2 623Z5468-1別ther information <-- this is the second line of the + 1_623Z5462-1003.CSV 2 623Z5468-9別ther information 2 623Z5468-7別ther information 2 623Z5468-5別ther information 2 CA623Z5462-1003別ther information 2 BACD40AC36B30別ther information 2 623Z5469-7別ther information 2 623Z5462-3別ther information <-- and this is the last line of t +he 1_623Z5462-1003.CSV 1 7010902H01吶ther information <-- continue to read the "root" fi +le 1 623Z5420-3307吶ther information 1 B3-15838吶ther information 1 623Z5422-3307吶ther information

      Note: OP has updated the post above with a much more detailed annotated explanation, so this answer may not make sense anymore.

      Sorry for my slowness, but I didn't quite follow originally what you meant. I think I get it now. The first part of the line ("440Z0220-932") identifies a file. The duplicate lines associated with "440Z0220-932" are for each line within the file identified by "440Z0220-932". Is that right? So if you had only the following inputs:

      # FILE #1: 0_IP_017.CSV (reduced to illustrate logic) 623Z5465-1001吶ther information 623Z5462-1003吶ther information # FILE #2: 1_623Z5465-1001.CSV 623Z5465-1001吶ther information 623Z5465-1吶ther information 623Z5465-11吶ther information CA623Z5465-1001吶ther information # FILE #3: 1_623Z5462-1003.CSV 623Z5462-1003別ther information 623Z5468-1別ther information 623Z5468-9別ther information 623Z5468-7別ther information 623Z5468-5別ther information CA623Z5462-1003別ther information BACD40AC36B30別ther information 623Z5469-7別ther information 623Z5462-3別ther information

      You would get the following output file?

      1 623Z5465-1001吶ther information #line in file #1 - ids file #2 2 623Z5465-1001吶ther information #line in file #2 2 623Z5465-1吶ther information #line in file #2 2 623Z5465-11吶ther information #line in file #2 2 CA623Z5465-1001吶ther information #line in file #2 1 623Z5462-1003吶ther information #line in file #1 - ids file #3 2 623Z5462-1003別ther information #line in file #3 2 623Z5468-1別ther information #line in file #3 2 623Z5468-9別ther information #line in file #3 2 623Z5468-7別ther information #line in file #3 2 623Z5468-5別ther information #line in file #3 2 CA623Z5462-1003別ther information #line in file #3 2 BACD40AC36B30別ther information #line in file #3 2 623Z5469-7別ther information #line in file #3 2 623Z5462-3別ther information

      Best, beth

      Update: finally got what OP meant and updated accordingly. The striken portion is below.

      This is much better, but it still isn't clear why, for example, the output has two lines with "440Z0220-932":

      0 440Z0220-932吶ther information 1 440Z0220-932吶ther information

      but only one of your sample input files (0_IP_017.CSV) has a line with "440Z0220-932" in it.

      Nor is it clear how you are defining that something is a node and what node number (0,1,2) to attach to it. For example, why is "440Z0220-932" assigned both 0 and 1 when it is only in the one non-"leaf" file? This doesn't seem consistent with your explanation above (at least to me).

      Perhaps you could give us a very small set of short input files and an output file with just a few sample lines and then explain (in words) the reasons why you assigned 0,1, or 2 to each of the output lines.