# HG changeset patch
# User František Kučera
+ Let's expect that we have a /etc/fstab
with many lines defining the mount-points (directories) of particular devices (disks) and we are using LVM.
+ If we rename a volume group (VG), we have to change all of them. The lines look like this one:
+
/dev/alpha/photos /mnt/photos/ btrfs noauto,noatime,nodiratime 0 0+ +
+ We want to change all lines from alpha
to beta
(the new VG name).
+ This can be done by:
+
+ Unlike the text-oriented sed
command, the relational relpipe-tr-sed
works only with given relation (fstab
) and given attribute (device
)
+ and it would leave untouched other relations and attributes in the stream.
+ So it would not replace the strings on unwanted places (if there are any random matches).
+
+ Even the relation names and attribute names are specified as a regular expression, so we can (purposefully) modify multiple relations or attributes.
+ For example we can put zeroes in both dump
and pass
attributes:
+
+ n.b. the data types must be respected, we can not e.g. put abc
in the pass
attribute because it is declared as integer
.
+
+ This tool also support regex groups and backreferences. Thus we can use parts of the matched string in our replacement string: +
+ +Which would convert this:
+ + +into this:
+ + +
+ If there were any other relations or attributes in the stream, they would be unaffected by this transformation,
+ becase we specified 'r' 'a'
instead of some wider regular expression that would match more relations or attributes.
+