Archive for the 'wtf' Category

Quote of the day

It is preferable to use complete links, it improves natural referencing, and tracking as well. (...) This recommendation comes from experts on these topics.

By "complete links", it is meant http://domain/some/path instead of /some/path.

Ah... SEO crap.

2009-06-27 08:44:05+0900

wtf | 1 Comment »

Useless use of …

(Inaugurating a new category which will be kind of my own dailty wtf)

A pretty well known matter is how some tools can be abused. Usually, it is cat or grep. Typical examples include the following two:

cat foo | grep bar

grep bar foo | awk '{print $2}'

Obviously, the first one can be reduced to:

grep bar foo

and the second, to:

awk '/bar/ {print $2}' foo

awk and sed are often part of the reason grep gets abused, because a lot of people don't know the latter form above or its sed equivalent. They don't know they could restrict the match on a specific column, too, which could be important in some cases.

Anyways, a few months ago, I saw the most beautiful short piece of combined useless use of something I've ever seen, which also happens to be a pretty unusual type:

more $file | wc | awk '{print $1}'

Not only does it use more where even cat, while still being useless, would be a better choice, but it also manages to use awk where wc could take an option to achieve the same goal.

Yes, the above can be simplified as:

wc -l < $file

We never found who was responsible for this nicety.

2008-12-20 11:17:51+0900

wtf | 8 Comments »