[Techtalk] text parsing question

gossamer axe gsmraxe at gmail.com
Thu Oct 26 17:27:32 UTC 2006


Hi!

I have a text file that looks like
,
question
,answer
,question2
,answer2
,
Now, I have to hand edit it to bring
,
question
,answer
to one line.  I was wondering if I can do something like that with sed
automatically...Based on the fact that each future line will have 3 present
lines.

What I'm looking to do is to import this to a mysql table which has 3
fields... id,question,answer but having the lines split like that makes it
imposible to import.  Even doing --fields-terminated-by=\n or \r or both
doesn't work.

So either making the text file automatically bring up two bottom lines to
the first or someway of importing newline delimited fields into mysql.  I
suppose a bash script to read each line in and maybe write it to a file
$var1,$var2,$var3 on one line.

-- 
Gossamer Axe
gsmraxe at gmail.com
http://gypsy.sytes.net/


More information about the Techtalk mailing list