relpipe-data/examples-rename-vg-fstab.xml
author František Kučera <franta-hg@frantovo.cz>
Mon, 21 Feb 2022 01:21:22 +0100
branchv_0
changeset 330 70e7eb578cfa
parent 329 5bc2bb8b7946
permissions -rw-r--r--
Added tag relpipe-v0.18 for changeset 5bc2bb8b7946
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     1
<stránka
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     2
	xmlns="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana"
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     3
	xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro">
0d2729ed16ed zkouška interního odkazu
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
     4
	
244
d4f401b5f90c examples: move each example to a separate page + add generated list of examples
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     5
	<nadpis>Renaming VG in /etc/fstab using relpipe-tr-sed</nadpis>
d4f401b5f90c examples: move each example to a separate page + add generated list of examples
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     6
	<perex>sed-like substitutions in the relational stream</perex>
d4f401b5f90c examples: move each example to a separate page + add generated list of examples
František Kučera <franta-hg@frantovo.cz>
parents: 241
diff changeset
     7
	<m:pořadí-příkladu>00700</m:pořadí-příkladu>
4
1bb39595a51c genrování hlavní nabídky #1
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     8
2
ab9099ff88fa vkládání zápatí, jmenné prostory, saxon
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
     9
	<text xmlns="http://www.w3.org/1999/xhtml">
176
46042297e0d6 relpipe-tr-validator: specification and examples
František Kučera <franta-hg@frantovo.cz>
parents: 140
diff changeset
    10
		
207
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    11
		<p>
210
f0a2916368e2 small fixes and improvements
František Kučera <franta-hg@frantovo.cz>
parents: 209
diff changeset
    12
			Assume that we have an <code>/etc/fstab</code> with many lines defining the mount-points (directories) of particular devices (disks) and we are using LVM.
207
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    13
			If we rename a volume group (VG), we have to change all of them. The lines look like this one:
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    14
		</p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    15
		
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    16
		<pre>/dev/alpha/photos    /mnt/photos/    btrfs    noauto,noatime,nodiratime    0  0</pre>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    17
		
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    18
		<p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    19
			We want to change all lines from <code>alpha</code> to <code>beta</code> (the new VG name).
208
91a210d3b66a examples: relpipe-tr-grep
František Kučera <franta-hg@frantovo.cz>
parents: 207
diff changeset
    20
			This can be done by the power of regular expressions<m:podČarou>see <a href="https://en.wikibooks.org/wiki/Regular_Expressions/Simple_Regular_Expressions">Regular Expressions</a> at Wikibooks</m:podČarou> and this pipeline:
207
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    21
		</p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    22
		
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    23
		<m:pre jazyk="bash"><![CDATA[relpipe-in-fstab \
329
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    24
	| relpipe-tr-sed \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    25
		--relation 'fstab' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    26
			--attribute 'device' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    27
			--value '^/dev/alpha/' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    28
			--replacement '/dev/beta/' \
207
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    29
	| relpipe-out-fstab]]></m:pre>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    30
	
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    31
		<p>
209
74fecc2ba590 small text update
František Kučera <franta-hg@frantovo.cz>
parents: 208
diff changeset
    32
			The <code>relpipe-tr-sed</code> tool works only with given relation (<code>fstab</code>) and given attribute (<code>device</code>)
207
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    33
			and it would leave untouched other relations and attributes in the stream.
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    34
			So it would not replace the strings on unwanted places (if there are any random matches).
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    35
		</p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    36
		
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    37
		<p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    38
			Even the relation names and attribute names are specified as a regular expression, so we can (purposefully) modify multiple relations or attributes.
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    39
			For example we can put zeroes in both <code>dump</code> and <code>pass</code> attributes:
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    40
		</p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    41
		
329
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    42
		<m:pre jazyk="bash"><![CDATA[relpipe-in-fstab \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    43
	| relpipe-tr-sed \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    44
		--relation 'fstab' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    45
			--attribute 'dump|pass' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    46
			--value '.+' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    47
			--replacement '0' \
5bc2bb8b7946 Release v0.18
František Kučera <franta-hg@frantovo.cz>
parents: 244
diff changeset
    48
	| relpipe-out-fstab]]></m:pre>
207
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    49
		
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    50
		<p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    51
			n.b. the data types must be respected, we can not e.g. put <code>abc</code> in the <code>pass</code> attribute because it is declared as <code>integer</code>.
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    52
		</p>
4e45b9a177c2 examples: relpipe-tr-sed
František Kučera <franta-hg@frantovo.cz>
parents: 198
diff changeset
    53
		
87
25dec6931f18 Lepší odsazení, tabulátory.
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    54
	</text>
4
1bb39595a51c genrování hlavní nabídky #1
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    55
1
a05c6f3cbc3e základ, první verze
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
</stránka>