3 ms·
Rather than SQL queries, you would be using the R language. Unless you use a package like sqldf. stdin can be read just like any other file.
by partycoder 9y ago
Rather than SQL queries, you would be using the R language. Unless you use a package like sqldf. stdin can be read just like any other file.
- marcle 9y agoFor what it's worth, if we define Rsql as the following script: #!/usr/bin/env Rscript library(sqldf, quietly=TRUE) statement <- commandArgs(TRUE) a <- read.table(file("stdin"), header=TRUE) print(sqldf(statement)) then we can call ps -Ao user | Rsql 'select USER, count(*) as nprocesses from a group by USER limit 5' to get the output USER nprocesses 1 avahi 2 2 colord 1 3 daemon 1 4 marcle 136 5 messagebus 1
- Myrmornis 9y agoCool! Thanks.