Friday, February 22

writing one-liners stoned

I wanted a quick visual of changetimes for a bunch of files.

ls -l | cut -c27-33 | sort -M | uniq -c | perl -pe 's/^\s+(\d+) (.*)$/$2 . "*" x $1/e'

...well, it works in Bash with GNU utilities, anyway. In a particular directory.

Nov 16 ***********************************
Nov 17 *********
Nov 18 ****
Nov 19 *******
Nov 20 ***************
Nov 21 ******
Nov 22 **********
Nov 23 ********
Nov 24 ***********************
Nov 25 ******
Nov 26 ***************
Nov 27 ******************************
...

In a more coherent moment, it occurred to me that all the date info I'm looking for already lives in a database. But you can't tell me that SQL which starts off like this is any less ugly:

SELECT date_added FROM products

Can you?

Dammit.