comment next line after line starting with root string
sed '/^root/ { n; s/^/#/ }' /etc/passwd
comment line 2 after line starting with root string
sed '/^root/ { n;n; s/^/#/ }' /etc/passwd
comment next line after line starting with root string
sed '/^root/ { n; s/^/#/ }' /etc/passwd
comment line 2 after line starting with root string
sed '/^root/ { n;n; s/^/#/ }' /etc/passwd
comment line starting with string and the next
sed '/^mail/,+1s/^/#/' /etc/passwd
comment line starting with string and the next 3 lines
sed '/^mail/,+3s/^/#/' /etc/passwd