Welcome to my website. I am always posting links to photo albums, art, technology and other creations. Everything that you will see on my numerous personal sites is powered by the formVistaTM Website Management Engine.

icon.linkedin.jpgicon.twitter.jpg

  • Edit a Range of Lines Using sed
    11/06/2019 4:24PM

    Let's say that you have a range of lines in a source file (lines 11 - 17) that you want to comment out with a '#' and a space character before the line.

    To do that, you would use sed, specifying a range of lines and then specify a replacement command with a capture group as follows:

    sed '11,17{s/\(\w\)/\# \1/}' filename.py

Advanced Search

Categories

Archives