Thursday, July 29

armed with a big stick

Execution time 60 seconds: Remembering enough Perl mojo to craft a one-liner search and replace.
Execution time 30 seconds: Running said one-liner on around 3000 text files.
Execution time 30 seconds: Realizing after termination of said one-liner that I got the replacement regex "slightly"* wrong.
Execution time 5 minutes: Banging head on nearest hard surface, groaning aloud to unseeing and uncaring deities and generally bemoaning my own fate.

and now, the punchline
Remembering that the textfiles were painstakingly downloaded from my university machine over the last 3 days: a lifetime of hurt

There is a reason why .bak below is not optional.
perl -i.bak -p -e 's/$search_text/$replacement_regex/ig' *.dat
Unfortunately, I remembered it a bit too late.



*For sufficiently large and catastrophic values of "slightly"

----
To err is human. To really mess things up, you need a computer. and me.

|

<< Home