[dundee] Parse text file into CSV

Axel newsletter at axelbor.de
Thu Dec 10 15:14:07 UTC 2009


Maybe awk or sed can help. But I don't know a how.

I would recommend to write a little Perl-Script. Thats task is easy to  
solve with Perl and I think it is faster to write the script than  
searching for another solution.

Axel


Quoting Kris Davidson <davidson.kris at gmail.com>:

> 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
>







More information about the dundee mailing list