robfelty.com


Strange bracketing behavior in grep and sed

Posted in linux

Quarter note = 09032008 robfelty
Treble clef 4/4 Time
I finally figured out this thorny issue I have been dealing with for the last hour. In perl, if I can create a character class like “[\[\]a-f]” which matches any characters a-f, [, and ]. This does not work in grep or sed though. I finally discovered that the right bracket “]” should not be escaped in grep or sed. I don’t really understand why. Perl will let you do it either way. You know what they say: “knowing is […]

Bash one-liners to the rescue

Posted in general, linguistics, linux

Quarter note = 07152008 robfelty
Treble clef 4/4 Time
I recently find myself using handy bash one-liners more all the time. I think that this is where unix/linux can really start to shine. There are so many little programs that just do one thing, and one thing well. But the ability to combine these together through pipes means you have extremely flexible and powerful tools at the ready. I have been working on a new project at work to come up with some lists for testing speech recognition. We […] (Read more)

sort using TAB as field separator in bash

Posted in linux

Quarter note = 07142008 robfelty
Treble clef 4/4 Time
I have run into this problem several times recently, and decided to finally write down the solution for myself rather than keep searching the internet for it. This is the problem: if you want to sort a file that is tab-delimited (and some of the filelds contain spaces), then you must explicitly tell sort to use TABS as the field separator, otherwise it will use any whitespace character. For functions such as cut and paste, this can be done like […] (Read more)

Xorg.conf configuration — solved font size problem

Posted in linux

Quarter note = 03212008 robfelty
Treble clef 4/4 Time
Awhile ago I started having problems with some of my fonts on my computer at work. Interestingly enough, it only seemed to affect a very small minority of programs and situations, namely on startup, when Fedora is going through and telling me all the services it is starting, the fonts were so tiny I could not read them. This also seemed to be the case for Matlab. For Matlab, I temporarily solved the problem by just changing the settings to […] (Read more)

convert pdf to png with imagemagick

Posted in linux, mac osx

Quarter note = 03112008 robfelty
Treble clef 4/4 Time
Imagemagick is a swiss-army knife of command-line image conversion, but can be a bit complicated to actually use. I have been making most of my figures with R lately, and printing them to pdfs, which I can include very easily into documents with pdflatex. I like pdf because it is scalable, fairly small file size (smaller than .eps), and portable. But today a colleague wanted to include a few of my figures in her own powerpoint presentation, and powerpoint only […] (Read more)