Code: awk '/^c/{f=1} ## If the first character of the line is "c" set f = 1 f {$0 = "#" $0} ## if f is not equal to 0, add "#" to beginning of line {print} ## print every line ' file
awk '/^c/{f=1} ## If the first character of the line is "c" set f = 1 f {$0 = "#" $0} ## if f is not equal to 0, add "#" to beginning of line {print} ## print every line ' file