Spending time on the R.A. Lafferty Devotional Page
If you like check out the newly structured R.A. Lafferty Devotional Page right on this site.
« October 2003 | Main | December 2003 »
If you like check out the newly structured R.A. Lafferty Devotional Page right on this site.
I write an importer....
Since I upgraded the forum software on the R.A. Lafferty Page I put off the import of the old boards for some spare time.
I figured I was gonna do it manually some time...
But now I've got a volunteer (a fellow Lafferty fan) who undertakes the task to prepare the old forum entries in CSV, so that I can import them into phpBB which is running on MySQL.
So I have to massage the flatfile a little to create entries into four distinct tables to geneate users, topics and posts.
The problem is, I don't know how to write perl. The old unix tools cut and awk can't handle the CSV because they don't deal with quoted text. Perl could do it but the syntax is something like
@new = ();
push(@new, $+) while $text =~ m{
"([^\"\\]*(?:\\.[^\"\\]*)*)",? # groups the phrase inside the quotes
| ([^,]+),?
| ,
}gx;
push(@new, undef) if substr($text,-1,1) eq ',';
I can't deal with that kinda shit.
So I made the (IMO) heroic effort and made mullecut, off the original textutils cut which is now able to handle quotes, escaped quotes and can deal with linefeeds, carriage returns and stuff. This makes this possible:
echo "ab""c";"abc";NULL; 0 | mullecut -f 1,4 -d';' -q'"' -e'\\' ab"c;0or
echo "ab""c";"abc";NULL; 0 | mullecut -f 1,4 -d';' -q'"' -e'\\' -r "ab""c";0Did I say I was very pleased with myself :)
Well maybe yes, maybe no.
Currently I need to spend almost all my time emptying the old appartment and renovating/ filling up the house with stuff.
Well after ZNeK previewed it I agreed with him that it was not a good start for the series, so I actually wanted to post it at the end of the series, which is soon to be written... :)
So now I pulled it and will repost it later this year or early next year.
This page contains all entries posted to Nat!'s Web Journal in November 2003. They are listed from oldest to newest.
October 2003 is the previous archive.
December 2003 is the next archive.
Many more can be found on the main index page or by looking through the archives.