Search Results

Search found 2 results on 1 pages for 'xorsyst'.

Page 1/1 | 1 

  • How to read postgresql dump file in Python

    - by xorsyst
    I'd like my Python script to read some data out of a postgresql dump file. The Python will be running on a system without postgresql, and needs to process the data in a dump file. It looks fairly straightforward to parse the CREATE TABLE calls to find the column names, then the INSERT INTO rows to build the contents. But I'm sure there would be quite a few gotchas in doing this reliably. Does anyone know of a module which will do this?

    Read the article

  • In Perl, how to match several prefixes

    - by xorsyst
    I have 2 input files. One is a list of prefix and lengths, like this: 101xxx 102xxx 30xx 31xx (where x is any number) And another is a list of numbers. I want to iterate through the second file, matching each number against any of the prefix/lengths. This is fairly easy. I build a list of regexps: my @regexps = ('101...', '102...', '30..', '31..'); Then: foreach my $regexp (@regexps) { if (/$regexp/) { # do something But, as you can guess, this is slow for a long list. I could convert this to a single regexp: my $super_regexp = '101...|102...|30..|31..'; ...but, what I need is to know which regexp matched the item, and what the ..s matched. I tried this: my $catching_regexp = '(101)(...)|(102)(...)|(30)(..)|(31)(..)'; but then I don't know whether to look in $1, $3, %5 or $7. Any ideas? How can I match against any of these prefix/lengths and know which prefix, and what the remaining digits where?

    Read the article

1