If we are interested only in certain records in some relation, we can filter it using relpipe-tr-grep
.
If we want to list e.g. only Btrfs and XFS file systems from our fstab
(see above), we will run:
relpipe-in-fstab \
| relpipe-tr-grep --relation 'fstab' --attribute 'type' --value 'btrfs|xfs' \
| relpipe-out-tabular
and we will get following filtered result:
fstab: ╭─────────────────┬──────────────────────────────────────┬──────────────────────┬───────────────┬──────────────────┬────────────────┬────────────────╮ │ scheme (string) │ device (string) │ mount_point (string) │ type (string) │ options (string) │ dump (integer) │ pass (integer) │ ├─────────────────┼──────────────────────────────────────┼──────────────────────┼───────────────┼──────────────────┼────────────────┼────────────────┤ │ UUID │ a2b5f230-a795-4f6f-a39b-9b57686c86d5 │ /home │ btrfs │ relatime │ 0 │ 2 │ │ │ /dev/mapper/sdf_crypt │ /mnt/private │ xfs │ relatime │ 0 │ 2 │ ╰─────────────────┴──────────────────────────────────────┴──────────────────────┴───────────────┴──────────────────┴────────────────┴────────────────╯ Record count: 2
Command arguments are similar to relpipe-tr-sed
.
Everything is a regular expression.
Only relations matching the regex will be filtered, others will flow through the pipeline unmodified.
If the attribute regex matches more attribute names, filtering will be done with logical OR
i.e. the record is included if at least one of that attributes matches the search regex.
If we need exact match of the whole attribute, we have to use something like '^btrfs|xfs$'
,
otherwise mere substring-match is enough to include the record.
Relational pipes, open standard and free software © 2018-2022 GlobalCode