relpipe-data/examples-rename-vg-fstab.xml
branchv_0
changeset 329 5bc2bb8b7946
parent 244 d4f401b5f90c
equal deleted inserted replaced
328:cc60c8dd7924 329:5bc2bb8b7946
    19 			We want to change all lines from <code>alpha</code> to <code>beta</code> (the new VG name).
    19 			We want to change all lines from <code>alpha</code> to <code>beta</code> (the new VG name).
    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:
    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:
    21 		</p>
    21 		</p>
    22 		
    22 		
    23 		<m:pre jazyk="bash"><![CDATA[relpipe-in-fstab \
    23 		<m:pre jazyk="bash"><![CDATA[relpipe-in-fstab \
    24 	| relpipe-tr-sed 'fstab' 'device' '^/dev/alpha/' '/dev/beta/' \
    24 	| relpipe-tr-sed \
       
    25 		--relation 'fstab' \
       
    26 			--attribute 'device' \
       
    27 			--value '^/dev/alpha/' \
       
    28 			--replacement '/dev/beta/' \
    25 	| relpipe-out-fstab]]></m:pre>
    29 	| relpipe-out-fstab]]></m:pre>
    26 	
    30 	
    27 		<p>
    31 		<p>
    28 			The <code>relpipe-tr-sed</code> tool works only with given relation (<code>fstab</code>) and given attribute (<code>device</code>)
    32 			The <code>relpipe-tr-sed</code> tool works only with given relation (<code>fstab</code>) and given attribute (<code>device</code>)
    29 			and it would leave untouched other relations and attributes in the stream.
    33 			and it would leave untouched other relations and attributes in the stream.
    33 		<p>
    37 		<p>
    34 			Even the relation names and attribute names are specified as a regular expression, so we can (purposefully) modify multiple relations or attributes.
    38 			Even the relation names and attribute names are specified as a regular expression, so we can (purposefully) modify multiple relations or attributes.
    35 			For example we can put zeroes in both <code>dump</code> and <code>pass</code> attributes:
    39 			For example we can put zeroes in both <code>dump</code> and <code>pass</code> attributes:
    36 		</p>
    40 		</p>
    37 		
    41 		
    38 		<m:pre jazyk="bash"><![CDATA[relpipe-in-fstab | relpipe-tr-sed 'fstab' 'dump|pass' '.+' '0' | relpipe-out-fstab]]></m:pre>
    42 		<m:pre jazyk="bash"><![CDATA[relpipe-in-fstab \
       
    43 	| relpipe-tr-sed \
       
    44 		--relation 'fstab' \
       
    45 			--attribute 'dump|pass' \
       
    46 			--value '.+' \
       
    47 			--replacement '0' \
       
    48 	| relpipe-out-fstab]]></m:pre>
    39 		
    49 		
    40 		<p>
    50 		<p>
    41 			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>.
    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>.
    42 		</p>
    52 		</p>
    43 		
    53