# HG changeset patch # User František Kučera # Date 1544474748 -3600 # Node ID 91a210d3b66a1f03864968401ded26acad5a7580 # Parent 4e45b9a177c295b89841c4ed9a259f55d687cca4 examples: relpipe-tr-grep diff -r 4e45b9a177c2 -r 91a210d3b66a relpipe-data/examples.xml --- a/relpipe-data/examples.xml Mon Dec 10 19:43:48 2018 +0100 +++ b/relpipe-data/examples.xml Mon Dec 10 21:45:48 2018 +0100 @@ -383,7 +383,7 @@

We want to change all lines from alpha to beta (the new VG name). - This can be done by: + This can be done by the power of regular expressionssee Regular Expressions at Wikibooks and this pipeline:

'r' 'a' instead of some wider regular expression that would match more relations or attributes.

+

Filter /etc/fstab using relpipe-tr-grep

+ +

+ 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: +

+ + + + +

and we will get following filtered result:

+
+ +

+ 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. +

+