September 8th, 2013, 06:41 AM
Convert list with headers into CSV
A txt document lists ITEMS under a REFERENCE to which they belong.
Each ITEM is a string of word characters and spaces on a single line.
Each REFERENCE is a string of two digits followed by a hyphen followed by three digits.
The number of items under each reference varies between one and thirty.
Can a regex help me add the corresponding REFERENCE to every ITEM line.
In other words, I need to get from there:
Any help or hints of the right approach would be greatly appreciated.
PS - I am not sure of my regex flavor. I use a text editor in Max OS X called "TextWrangler" with GREP searching...
September 8th, 2013, 01:54 PM
Hmm, it is easy to do that with a programming language using regexes, doing that in pure regexes, I am not sure how it could be done.