Recfiles Extended Example

Create

Make a database for your boardgames, specifying only one field and value:

1database=games.rec
2n=Name
3g=Vojvodina
4touch $database
5recins -f $n --value $g $database
6recsel $database

Insert a few more, with the estimated playtime:

1recins -f Name -v Saboter -f Playtime -v 30 $database
2recins -f Name -v Chess -f Playtime -v 30 $database

View all games, or select one by number:

1recsel $database
2recsel -n 0 $database

Each game should note whether or not you have played it yet, so you can add that field and set the default to yes.

1f=played
2v=yes
3recset -f $f -a $v $database

...but the field is wrong, it should have a capital letter:

1new_field=Played
2recset -f $f --rename $new_field

Read

Check how many records the database has:

1recinf $database

Look at just the games you've never played:

1recsel --expression="Played = 'no'" $database

Print how many, then just print the names:

1recsel -e "Played = 'no'" --count $database
2recsel -e "Played = 'no'" --print=Name $database

Update

To change a game's Played field from no to yes, use recset to specify the number, and change that field.

1num=0
2f=Played
3value=yes
4recsel --number=$num $database
5recset --number=$num -f $f --set=$value $database

Find all games with a playtime of 30, and set the field Max_Players to 4.

1recset -e "Playtime = 40" -f Max_Players --set 50 games.rec

This doesn't work, because that field does not exist. You can --set-add the field, to add it wherever it does not exist.

1recset -e "Playtime = 40" -f Max_Players --set-add 50 games.rec

Delete

Remove Played record from first game:

1num=0
2recset --number=$num -f Played --delete $database

You can comment the line instead of deleting it:

1num=1
2recset --number=$num -f Played --delete $database
3recsel $database
4cat $database

Delete an entire record:

1num=2
2recdel --number=$num $database