Home | Articles | CV (pdf | short)
<2012-11-09> by Lorenzo

Useful scripts - c+/c-

This is the second post of a series describing simple scripts that I wrote to ease my life as a programmer.

They are available on github: fork & hack at will!


In this post I'll describe a very simple script, c+, and its counterpart c-.

c+ prepends every line of stdin with #. c- strips # from the beginning of each line of stdin. I use these scripts to comment/uncomment lines in Python scripts when using acme.


Figure 1: c+/c- in acme

Here is the code:


#!/usr/bin/env rc

sed 's/^/#/'


#!/usr/bin/env rc

sed 's/^#//'