2013/6/3 Cecil Westerhof <[email protected]>:
> At the moment I use from a script:
>     java -cp /home/cecil/java/h2/bin/h2-1.3.171.jar org.h2.tools.Shell …
>
> When using interactively I can use list to change to list mode. This
> does not work when using it in a batch script. Am I doing something
> wrong, or is this again something I need to give a patch for? ;-)

Well, for using it from a BASH script I do the following:
    (java -cp /home/cecil/java/h2/bin/h2-1.3.171.jar org.h2.tools.Shell <<EOT
    jdbc:h2:tcp://localhost/~/databases/quotes




    LIST
    SELECT 1
    ;
    SELECT   quote
    ,        author
    FROM     quotes
    ,        authors
    WHERE    quotes.authorID = authors.authorID
    ORDER BY RAND()
    LIMIT    10
    ;
    EXIT
    EOT
    )  | grep --only-matching '\(QUOTE :.*$\)\|\(AUTHOR:.*$\)'

Maybe it is useful to someone else also. ;-)

I cannot use the preferred way:
    grep '^\(QUOTE :.*$\)\|\(AUTHOR:.*$\)'

because the first result is appended with ‘garbage’.

-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to