Re: OT: Help with a search and replace script in Perl for a big file with no line breaks
David Christensen wrote:
> I used to subscribe to Perl Beginners, but the administrator got draconian
> about discussing other languages, I dropped, and now I appear to be
> banned:
>
> https://lists.perl.org/list/beginners.html
>
>
>> I've never used Perl, but I'm hoping Perl can do the job for me.
>>
>
> Modern Perl (version 5.10 and up) is a UTF-8 compliant, general purpose
> language, but much of software today is closed and baroque. You want to
> use whatever language the database designers had in mind.
>
The way you are writing, no wonder you are banned.
Read once again the original post.
> If you attack the files with raw Perl, you're going to be writing a lexer
> and parser to read the database dump into a data structure, and then doing
> your work against that (perhaps by dumping it to a common format and then
> writing tools against that). If you don't have an EBNF grammar for the
> dump, you'll have to figure it out. Getting the lexer/ parser right, and
> verifying that you got it right, is going to be a lot of work.
>
you don't know what OP wants to do - OP did not say that
>
> Your best bet is to:
>
> 1. Have the database administrator generate exports in a friendlier
> format, such as flat-file comma-seperated values, tab-seperated values,
> XML, etc..
>
> 2. Get a tool that understands the dump file (such as the original
> database engine), import the dumps, and then generate queries/ reports/
> etc. as desired to meet your needs.
This is probably the best solution to the problem - import the dump and
export in a friendly way
regards
Reply to: