Simple, fast SQL queries for flat files

前端 未结 8 893
广开言路
广开言路 2021-02-04 07:24

Does anyone know of any tools to provide simple, fast queries of flat files using a SQL-like declarative query language? I\'d rather not pay the overhead of loading the file in

8条回答
  •  醉梦人生
    2021-02-04 07:56

    I never managed to find a satisfying answer to my question, but I did at least find a solution to my toy problem using uniqs "-f" option, which I had been unaware of:

    cat animals.txt | sort -t " " -k1,1 -k2,2nr \
    | awk -F' ' '{print $2, " ", $1}' | uniq -f 1
    

    The awk portion above could, obviously, be skipped entirely if the input file were created with columns in the opposite order.

    I'm still holding out hope for a SQL-like tool, though.

提交回复
热议问题