shiyan/file-to-sqlite

使用正则表达式将文件中的数据复制到SQLite数据库。

0.4.0 2018-04-14 19:31 UTC

This package is auto-updated.

Last update: 2024-09-14 18:31:41 UTC


README

这是一个命令行工具,用于使用正则表达式将文件数据复制到SQLite数据库文件。

非常适合转换自动日志文件、报告等。

要求

安装

composer global require --optimize-autoloader shiyan/file-to-sqlite

请确保将COMPOSER_HOME/vendor/bin目录添加到您的PATH环境变量中。更多信息请参阅composer帮助:composer global -h

如果您已安装CGR,则运行以下命令代替上面的命令

cgr -o shiyan/file-to-sqlite

用法

file-to-sqlite [options] [--] <source> <destination> <pattern>
参数
source                 Path to the source file.
destination            Path to the SQLite database file. If not exists, it will
                       be created.
pattern                Regular expression pattern with named subpatterns.
选项
-t, --table=TABLE      Table name. By default, the source file name is used.
-i, --integer=INTEGER  List of integer fields. (multiple values allowed)
    --blob=BLOB        List of blob fields. (multiple values allowed)
    --real=REAL        List of real fields. (multiple values allowed)
    --numeric=NUMERIC  List of numeric fields. (multiple values allowed)
-p, --primary=PRIMARY  Primary key(s). (multiple values allowed)
-a, --append           If the table exists, this option allows to insert into it
                       anyway.