Software: GCalCLI (and how to replace straight quotes with SED)

GoogleCL was a nice program to get quite a bit of your Google information in and out of the cloud via the commandline instead of a bloated interface. For example, I used it to pull down my agenda from Google Calendar and then incorporate that into all sorts of fun things.

It is (was, depending on when you read this) hosted on Google Code (and quite a few people have exported it to GitHub – here’s one example.

But there’s been problems with the API for the Google Calendar for a while. (Non-tech version: It stopped working.)  In comes GCalCLI, which uses API version 3 (Non-tech version: it works). 

It is also a LOT more powerful than GoogleCL’s version was – especially in terms of customization and display.  Take a look at this screenshot from the repository:

This works really well for me, except for one thing – I often pipe the output through other scripts.  Many of which use “straight” quotation marks to mark where they are supposed to start and stop doing things.

…and many of my events (like Bob’s birthday or Go to “the thing” at someone’s place) also include straight quotes, so my scripts fail.

Luckily SED (mentioned here before) comes to the rescue.  (Presuming your terminal supports UTF-8, of course.)

gcalcli agenda | sed “s/’/’/g” | sed ‘s/”(.*)”/“1”/g’

Obviously, this little trick will work anywhere you need to turn straight quotes into smart quotes (as long as they’re paired), and you can swap the straight and smart quotes in order to reverse the effect when you need to remove smart quotes.

Popular posts:

  • Moving Beyond Toxic Empathy
  • Odds and Ends: Optimizing SSHFS, moving files into subdirectories, and getting placeholder images
  • Advice Needed: How to Tell Someone They've Been Hit With A Publishing Scam
  • I am resigning as the programming director for Context, effective immediately.
  • Cinncinati Archdiocese to Employees: You must all be Catholic, and We Don't Trust You.
  • A helpful hint to politicians and groups that use call centers
  • Automagically Sort Downloads By Category with uGet on Windows and Linux (and replace KGet if you need to)