kirtivardhan has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am a Perl beginner. I want to query a DB and output the result row by row to text files.
eg.
sr.no. Name CodeBlock
1. mail afdsklj
afdskj
adsfasfddsaf
2. abcd l;kk;k;oiewrj
werkdsmjudjem
werjhdsujnsl
afl;af;lweorpi
3. wxyz adskflasflkafdj
kajdsflkjadslkjfa
output should be 3 text files
namely mail with content
afdsklj
afdskj
adsfasfddsaf
abcd with content
l;kk;k;oiewrj
werkdsmjudjem
werjhdsujnsl
afl;af;lweorpi
and wxyz with content
adskflasflkafdj
kajdsflkjadslkjfa
.
I am getting stuck because my code block is of variable length.
The codeblock contains several new line characters, tab and several
other commonly used separators. Hence, I am using a shell script to query
the db. The shell script outputs my query result separated by a string "(_KJ_)".
I tried using while $sqlout regmatch "(_KJ_)" create file and
and copy content to file close file. but with this I get just the first file.
I am unable to get perl read till the end of the file.
Please Help
KJ..
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: export table to text.
by gone2015 (Deacon) on Oct 15, 2008 at 16:28 UTC | |
|
Re: export table to text.
by Illuminatus (Curate) on Oct 15, 2008 at 16:39 UTC | |
|
Re: export table to text.
by jethro (Monsignor) on Oct 15, 2008 at 16:53 UTC | |
|
Re: export table to text.
by missingthepoint (Friar) on Oct 16, 2008 at 03:11 UTC | |
by kirtivardhan (Initiate) on Oct 16, 2008 at 11:23 UTC | |
by missingthepoint (Friar) on Oct 17, 2008 at 07:48 UTC | |
by Anonymous Monk on Oct 21, 2008 at 09:10 UTC | |
by kirtivardhan (Initiate) on Oct 21, 2008 at 15:03 UTC | |
by Anonymous Monk on Jun 19, 2009 at 05:23 UTC |