Q:

Prepend ## to every line in a text file

I want to add hashes to all the lines in a regular text file. I'm fine with both the use of terminal and GUI—I just need to get it done.

A:

You can use sed to do that:
sed -i.bak 's/^/##/' file

This replaces the start of the line (^) with ##. 
With the -i.bak switch, sed edits the file in-place, but creates a backup copy with extension.bak.

A:

Here is a solution to this problem using perl
perl -e 'while (<>) {print "##$_"}' < infile > outfile

A:

While we are at it:
gawk -i inplace '{print "##"$0}' infile

This uses the (comparatively new) inplace editing plugin for GNU awk 4.1.0+.

