This example shows how sed is used in scripts to substitute text. The script reads input lines, applies the substitution command s/World/Bash/, which replaces the first occurrence of 'World' with 'Bash' on each line, then outputs the result. If the pattern is not found, the line is output unchanged. Adding the 'g' flag to the command replaces all occurrences on a line. The execution table traces each input line, the sed command applied, the substitution result, and the output. The variable tracker shows how input and output text change step by step. Key moments clarify common confusions about sed's default behavior and flags. The visual quiz tests understanding of the substitution results and effects of flags.