[dundee] Parse text file into CSV
Robert Ladyman
it at file-away.co.uk
Thu Dec 10 15:15:41 UTC 2009
Python has a CSV library for output, processing the input should be easy
enough.
> Okay I'm looking to turn a directory of text files into a CSV file.
> The CSV needs to have 3 columns: title, parapragh, text - with either
> each new file being added to the row or getting a newline.
>
> An example text file would look like this (the number of paragraphs is
> variable depending on the text file)
>
> -----------------------------------------------------------------------
> Title
>
> first paragraph first paragraph first paragraph first paragraph first
> paragraph first paragraph etc
>
> second paragraph second paragraph second paragraph second paragraph
> second paragraph etc
>
> third paragraph third paragraph third paragraph third paragraph third
> paragraph third paragraph third paragraph
> -----------------------------------------------------------------------
>
> Colunm 1 needs no explanation, column 2 will be just the first
> paragraph in the file, column 3 will be all of paragraphs with
> linebreaks being replaced with something say <BR>
>
> Anyway does anyone have idea ideas, command strings or code.
>
> Kris
>
> _______________________________________________
> dundee GNU/Linux Users Group mailing list
> dundee at lists.lug.org.uk http://dundeelug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/dundee
> Chat on IRC, #tlug on irc.lug.org.uk
>
--
Robert Ladyman
File-Away Limited, 32 Church Street, Newtyle
Perthshire, PH12 8TZ SCOTLAND
Registered in Scotland, Company Number SC222086
Tel: +44 (0) 1828 898 158
Mobile: +44 (0) 7732 771 649
http://www.file-away.co.uk
More information about the dundee
mailing list