fork download
  1. #!/bin/bash
  2. # your code goes here
  3. echo "I am testing with sample, use sed -i to make the change permanent into the file"
  4. echo -e "\ncommenting starts\n"
  5. echo -e "option domain-name example.org;\ndont touch me \noption domain-name-servers ns1.example.org\ndont touch this" | sed 's/^option domain-name/#option domain-name/'
  6. echo -e "\nuncommenting starts\n"
  7. echo -e "#option domain-name example.org;\ndont touch me \n#option domain-name-servers ns1.example.org\ndont touch this" | sed 's/^#option domain-name/option domain-name/'
Success #stdin #stdout 0.01s 5440KB
stdin
Standard input is empty
stdout
I am testing with sample, use sed -i to make the change permanent into the file

commenting starts

#option domain-name example.org;
dont touch me 
#option domain-name-servers ns1.example.org
dont touch this

uncommenting starts

option domain-name example.org;
dont touch me 
option domain-name-servers ns1.example.org
dont touch this