recfile fixes

This commit is contained in:
Malin Freeborn 2025-02-12 23:01:50 +01:00
parent 5afc414a52
commit d2934bf8a3
Signed by: andonome
GPG Key ID: 52295D2377F4D70F
2 changed files with 34 additions and 0 deletions

View File

@ -44,6 +44,7 @@ recset -f "$new_field" --delete $database
- [Extended example](recfiles/extended.md)
- [Playing with board games data](recfiles/Board_Games.md)
- [Fixes](recfiles/recfixes.md)
# Resources

33
data/recfiles/recfixes.md Normal file
View File

@ -0,0 +1,33 @@
---
title: "Recfixes"
tags: [ "data", "recfiles" ]
requires: "Recfiles"
---
Sometimes `recsel` chokes on a large query, and you need to break the query into chunks with a pipe.
This Kickstarter file has 374,853 records.
Here's the chonky query:
```sh
recsel kick.rec -e "Category = 'Games'" -p "Subcategory,Avg(Goal)" -G Subcategory
```
It breaks down like this:
| Chunk | Meaning |
|:-----------------------------:|:---------------------------------------------:|
| `recsel kick.rec` | Select records from `kick.rec` |
| `-e "Category = 'Games'"` | Select only records where Category = 'Games' |
| `-p "Subcategory,Avg(Goal)"` | Print the Subcategory and average goal |
| `-G "Subcategory"` | Group by subcategory |
Two ways to break the query apart:
```sh
recsel kick.rec -e "Category = 'Games'" | recsel -p "Subcategory,Avg(Goal)" -G "Subcategory"
recsel kick.rec -e "Category = 'Games'" > games.rec
recsel games.rec -p "Subcategory" -G "Subcategory"
```