* Something like this might do it: tr "\n" "\",\"" < file > newfile sed -e "s/\",\"* /\n\",\"*/g" newfile > blah.csv On Mon, Jan 18, 2016 at 1:44 AM, Andrew wrote: > Example: > > * Micro topic 1 > ** Microbes are small > ** You can't see them! > *** Isn't that something? > * Micro topic 2 > ** I hope I like the teacher > *** She will be great! > ** Micro is cool! > > I'd like to convert them into a .csv file like so: > > "* Micro topic 1"," "** Microbes are small", "** You can't see them!", "*** > Isn't that something?", > "* Micro topic 2", "** I hope I like the teacher", "*** She will be > great!", > "** Micro is cool!" > > Where the first column contains only top level headings (lines beginning > with > one star), and the following columns are subheadings belonging to the top > level heading. So for each top level heading, there is one row containing > the top level heading and its children. I've been messing around with a > solution in python with regular expressions as well as macros but haven't > gotten very far. Any suggestions? > > > >