Description
In the following example, we want to replace every 'CLASS=...'
with the first 'CLASS=...' in the file.
|
| Raw Input
|
| Desired Output
| NOTE=mandatory
CLASS=coreutils
CMD=whoami
CLASS=fileutils
CMD=chmod
NOTE=mandatory
CLASS=textutils
CMD=tr
|
| NOTE=mandatory
CLASS=coreutils
CMD=whoami
CLASS=coreutils
CMD=chmod
NOTE=mandatory
CLASS=coreutils
CMD=tr
|
|
Script and Comments
Script1 [ 1] /^CLASS=/!b
[ 2] h
[ 3] :loop
[ 4] /^CLASS=/g
[ 5] n
[ 6] b loop
| |