lk/data/recfiles.md

54 lines
925 B
Markdown
Raw Normal View History

2025-02-07 16:07:38 +00:00
---
title: "Recfiles"
tags: [ "data", "database" ]
---
2025-02-10 19:32:04 +00:00
Create:
2025-02-07 16:07:38 +00:00
2025-02-10 19:32:04 +00:00
```sh
2025-02-07 16:07:38 +00:00
database=games.rec
touch $database
2025-02-10 19:32:04 +00:00
for g in Vojvodina Saboter Carcassonne Chess; do
2025-02-07 16:07:38 +00:00
recins -r "Name: $g" -r "Played: yes" $database
done
2025-02-10 19:32:04 +00:00
```
Read:
2025-02-07 16:07:38 +00:00
2025-02-10 19:32:04 +00:00
```sh
recsel $database
2025-02-07 16:07:38 +00:00
query=Carc
2025-02-07 19:26:17 +00:00
recsel --quick=$query $database
2025-02-07 16:07:38 +00:00
2025-02-10 19:32:04 +00:00
game=Vojvodina
recsel --expression="Name = '${game}'" $database
```
2025-02-07 16:07:38 +00:00
2025-02-10 19:32:04 +00:00
Update:
2025-02-07 16:07:38 +00:00
2025-02-10 19:32:04 +00:00
```sh
recset --expression="Name = '${game}'" -f Played --set="no" $database
2025-02-07 16:07:38 +00:00
new_field=Played
value=no
2025-02-10 19:32:04 +00:00
recset -f "$new_field" --delete $database
2025-02-07 16:07:38 +00:00
recset -f "$new_field" --set-add="$value" $database
recsel $database
2025-02-10 19:32:04 +00:00
```
2025-02-07 16:07:38 +00:00
2025-02-10 19:32:04 +00:00
Delete:
2025-02-07 16:07:38 +00:00
2025-02-10 19:32:04 +00:00
```sh
recdel --expression="Name = '${game}'" $database
2025-02-07 16:07:38 +00:00
recset -f "$new_field" --delete $database
```
- [Extended example](recfiles/extended.md)
2025-02-10 00:02:12 +00:00
- [Playing with board games data](recfiles/Board_Games.md)
2025-02-07 16:07:38 +00:00
# Resources
- [Recfiles for gemini capsules](gemini://tilde.town/~dozens/gemlog/21.gmi)
2025-02-07 19:30:35 +00:00
![Recfiles](/tapes/recfiles.gif)