Category: perl
-
Photos, EXIF, IPTC oh my!
Today I wanted to make a post on my blog with a bunch of pictures. I used my Canon DSLR over the weekend, and I imported all the pictures into the Photos app on my Mac. My normal workflow is to first go through all the pictures and choose the best, which is usually somewhere…
-
UNIX tip of the day – grep -P is slow
Unless you really need some advanced regular expressions only supported by PCRE, using POSIX regular expressions with grep is usually an order of magnitude faster – that’s because the default engine with grep uses finite automata, as opposed to a backtracking algorithm which PCRE uses ( the main featuress you gain from the backtracking algorithm…
-
Unicode block names in regular expressions
Frequently, I find myself wanting to do some simple language detection. For Chinese, Japanese, and Korean, this can easily be done by looking at the types of characters in some text. The simplest and most robust way to do this is to use Unicode block names. It is very simple to write a regular expression…
-
Why doesn’t Mac update standard UNIX utilities?
I am currently teaching a course on programming for linguists. We are using python, but for the first few classes, I have been going over some standard UNIX utilities like cd, ls and such, plus using regular expressions with grep and sed. I actually don’t use sed that much. I tend to reach for perl,…
-
Perl slurping
It seems like whenever I go to slurp in a whole file into a string in Perl, I have to search around to remember the exact syntax. So I decided to put it here for myself, so I won’t have to search any further than my own site. In this particular instance, I am trying…