There are two main aspects to enhancing programming productivity, and they are what I like to call physical (decrease actual human activity) and mental (knowing the smartest way to accomplish a task) types. Humans are slow, so I want to help you prevent that slowness from killing your face-melting programming dreams.
Stop typing so much!
One great way to enhance your physical productivity is, obviously, to type less. You know what you want to do and it should take no time for you to tell your computer to do it. On the command-line, we can do this most easily with smart aliases, and perhaps creating functions that streamline our tasks for us so that we can accomplish this.
I’m going to share with you a few techniques I use to cut the number of keystrokes I type significantly while boosting my efficiency, so break out Cygwin or your favorite terminal and let’s get started.
Find out what commands you use most frequently
Here is a quick command you can use to figure out the 10 most used commands in your history (learned from lifehacker’s post):
Continue reading →
AWK is a very powerful programming language that we can use on the command-line for advanced text processing. I’d like to provide a guide so you can get started using it. I’ll be covering the basics of AWK (named after Alfred Aho, Peter Weinberger, and Brian Kernighan) and provide some useful examples.
Tutorial
To best introduce awk I’d like to start with a practical example. Most of the applications for awk that I’ve dealt with involve formatting some output or data into something cleaner and more usable. This is certainly not the limit of awk, it is a full fledged language with all the power and responsibility to go with it.
Awk operates on one "record" at a time, which is each line by default. Each "field" in a record is separated by a space (by default) or another defined separator (using the -F option).
Continue reading →
We will learn about the sed delete (d), read (r) and write (w) commands today to round out your sed toolbox. Obviously, I won’t be covering everything about sed. I literally have a book on sed that I keep handy because there is so much to it. The major parts I am covering should help you through 99% of the cases where sed is your best option.
Soon we’ll be looking at awk and other tools to continue the quest for command-line fluency. If you haven’t already, install Cygwin and check out part 1 and part 2.
Tutorial
One of the best ways to crank out code quickly is by using templates. Using the Stream EDitor, you can streamline the use of templates.
Continue reading →