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!

c+/c-

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.

cc_acme.png

Figure 1: c+/c- in acme

Here is the code:

c+

#!/usr/bin/env rc

sed 's/^/#/'

c-

#!/usr/bin/env rc

sed 's/^#//'