0
I've this plain text file that I need to be automatically examined and results written in another plain text file. Note that I'll use plain text and CSV interchangeably, since CSVs are plain text with common separator between data (commas, tabs, etc).
Data examples
ABD-01A
ABD-01B
ABD-01C
AL-25A
AL-25B
Process one - recognize the first two sections of the data (text
-number
) to repeat and count them in output CSV:
ABD-01,1
ABD-01,2
ABD-01,3
AL-25,1
AL-25,2
Process two - First part of the data gathered above has sort of a primary key assigned to them on a different file. I would like to get the primary keys mentioned in the newly generated files as well:
#primary key file
1,ABD-01
2,ABD-02
3,AL-02
20,AL-25
#newly generated file
1,ABD-01,1
1,ABD-01,2
1,ABD-01,3
20,AL-25,1
20,AL-25,2
So basically, what I'm asking her is if there's any software that can help me with this on either Windows or Linux-based operating systems. Bash can help me with simpler processing, but I don't think it can handle this much. Please advise.
Can the same data occur multiple times in the same file? (for example, "
ABD-01A
,ABD-01B
,AL-25A
,ABD-01A
"...) – user1686 – 2012-01-25T15:22:16.270@grawity No, all the data are unique. – Oxwivi – 2012-01-25T16:27:33.193
In that case, you could use the example scripts I provided in my other comment. (Both do the same, but written in different languages so you can compare.) – user1686 – 2012-01-25T17:34:48.360