Feel the zsh of the rhythm of the night

Say, for example, that you were a rabid Miami Sound Machine fan, but you were subjected to grave trauma, and now you are so emotionally handicapped that a mere reminder will send you into hysterics.

Perhaps you keep your diary in multiple files in a directory somewhere, and you decide that you want to revise history and wipe out any files that mention Gloria Estefan.

rm $(grep -l "Gloria Estefan" diary/*)

That's pretty easy, but, maybe you want to preserve as much as you can stomach, and you've learned that you can handle seeing “Gloria Estefan” every once in a while. So you only want to delete files that have “Gloria Estefan” more than once.

rhythmisgonnagetyou() {
[[ $(grep -c "Gloria Estefan" $REPLY) -gt 1 ]] 
}

rm *(+rhythmisgonnagetyou)

Of course, you can make it much more complex.

Posted on 2005-11-08
Tags: