Monthly Archives: August 2011

Oh God, let all the peoples praise thee!

Bill Hybels gracious announcement that Starbuck’s Howard Schultz backed out of a conference because of a few misinformed protesters.

I love his explanation of Willow Creek’s stance on sexual ethics. This is how the church should be; open to all. My home church has the motto emblazoned on the front wall from Psalm 67:3:

Oh God, let all the peoples praise thee!

If only we could live out that ideal and be more open to encourage it, more accepting of people (like Jesus did) and allow God to do the work of changing us into his likeness (like Jesus did).

Jesus taught people and corrected people but never rejected them, he was never ‘anti’ anyone or any particular lifestyle or social group and neither should his church be.

Removing duplicate lines with awk

Often I’ve found the need to manipulate text files in various ways and I’ve found the powerful awk/gawk program invaluable saving me many hours of repetitive work. The latest one-liner I used though left me stumped as to how it actually works. Very simply I had an unsorted list of several hundred email addresses and I needed to remove the duplicates from the file, this was the solution I found on a number of websites…

awk '!x[$0]++' mail-list.txt

It look good and worked great, but nowhere could I find an explanation of what it’s actually doing until I came across this thread on

Sorting is not necessary. All it does is create an (associative) array element with the entire line as the index without a value (or 0 is you will). The exclamation mark negates that value so the outcome is 1 (true). The value of 1 in awk means perform the default action which is {print $0} so the entire line gets printed. Afterwards the ++ comes into action and 1 is added to the array value, which now becomes 1. So that next time the same line is encountered the value returned by the array is 1 which is then negated to 0 by the exclamation mark, so nothing will get printed

Thanks to Scrutinizer on