LWN.net Logo

Special filenames

Special filenames

Posted Mar 23, 2009 20:00 UTC (Mon) by epa (subscriber, #39769)
Parent article: Malcolm: SQL for the command line: "show"

show host, "count(*)", "total(size)" from /var/log/httpd/*access_log*
And what happens when there is a file called 'where'?

OK, in this example it would be /var/log/httpd/where which presumably wouldn't trip up the parser. But using this thing in your current directory could be flaky.


(Log in to post comments)

Special filenames

Posted Mar 24, 2009 15:26 UTC (Tue) by efexis (guest, #26355) [Link]

Standard unixy shell methodology, 'show' reads from standard input, so becomes:

show host, "count(*)", "total(size)" < /var/log/httpd/access_log

or

cat /var/log/httpd/*access_log* | show host, "count(*)", "total(size)"

would solve that

Special filenames

Posted Mar 24, 2009 21:36 UTC (Tue) by skx (subscriber, #14652) [Link]

Or just use asql which has a nice built-in shell for live queries, or the ability to run queries from the command line.

Special filenames

Posted Mar 28, 2009 11:22 UTC (Sat) by jengelh (subscriber, #33263) [Link]

Here you have your Useless Use Of Cat Award.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds