Google Release Command Line Tool: GoogleCL
Having been raised on the good old fashioned ZX Spectrum and introduced to PCs via MS-DOS I have something of a nostalgic fascination with command line interfaces, there’s something beautifully simplistic about using a good command line – like you’re talking to the machine directly. I’m not just talking about using the pseudo DOS-shell that comes with NT or the ubiquitous Unix/Linux command line, it’s the more exotic examples that pique my interest which is why I’m quite excited about the new Google command line tool.
Essentially GoogleCL is a Python application that can be executed at the command-line to make calls to various Google APIs, it currently offers limited support for Blogger, Calendar, Contacts, Docs, Picasa and YouTube but I’m certain that Google will deliver more features in the future. In terms of security, there’s a one-time authentication process for each application whereby the command-line tool launches a page in your default web browser to grant access for the GoogleCL tool. To me, the most interesting examples that Google provide are those allowing content creation…
- google blogger post blogpost.txt
- google calendar add "Dinner party with George today at 6pm"
- google contacts add "J. Random Hacker, jrandom@example.com"
- google picasa create --title "Vermont Test" --tags Vermont vermont.jpg>
- google youtube post --category Education --devtags GoogleCL killer_robots.avi
There may not be many obvious ties to the world of Business Intelligence here as GoogleCL is still in its infancy but for now at least you could perhaps drive scheduling through Google Calendar, maintain distribution lists in Google Contacts or automatically upload reports to Google Docs. I’m quite sure the possibilities will expand over time though especially since some major Google products are currently not included (e.g. Search, Gmail) – I, for one, will be watching with great expectations.
Categories: Google, The Cloud, Tools & Utilities Tags: blogger, calendar, cloud, command line, docs, Google, GoogleCL, picasa, Python, youtube
How To Install GoogleCL on Mac OSX Snow Leopard
If you’ve not heard the buzz already Google have released a Command Line tool called GoogleCL, you can install in in Windows by following Isaac Truett’s guide to”Setup GoogleCL on WinXP“ but if you’re using a Mac and you’d like to install it and have a play here’s a few simple instructions…
- Enable your Root login (instructions from Apple in KBHT1528).
- Log in as Administrator (bear in mind your normal user shouldn’t have Admin rights).
- Download and install Xcode.
- Download and install MacPorts.
- Open up Terminal.
- Edit your ‘paths’ file: sudo vi /etc/paths
- Add a new line (press ‘i’ then scroll to the bottom first): “
/opt/local/bin“. - Save the file (press ESC, then type “wq!”).
- Close Terminal and re-open.
- Type:
sudo port install googlecl, and press Enter (this takes a while). - Log off as the Administrator.
- Log back in as yourself and test (see examples).
Categories: Google, The Cloud, Tools & Utilities Tags: blogger, calendar, command line, Contacts, docs, Google, GoogleCL, picasa, youtube
Extract Rows from Files using QGrep
Whether you work with enterprise Data Warehouses, departmental Data Marts or live operational OLTP systems there’s a good chance that at some point you’ll have a need to import or export data using flat files. Flat files are great to read because they’re typically in common easy to understand formats such as CSV, the problem comes when you’ve got extremely large volumes of data that exceed your ability to handle them in Excel (e.g. over 65,536 rows for Excel 2003) or when you absolutely must preserve the initial file format.
I had a requirement recently to extract all rows relating to just one customer from an input file containing tens of thousands of rows and I had to leave the structure intact so that the existing SSIS loader would recognise the file. Sadly the standard Windows command-line utilities are a bit lacking in this regard but you can download the Windows Server 2003 Resource Kit which among other things includes the QGrep tool.
QGrep is simply a Windows equivalent of the Grep command available in Linux and Unix, there is no GUI but if you’re doing something simple the syntax is fairly straight-forward (see SS64.com for more info), in my case I needed to extract all records from “input.csv” containing the CustomerID “476226235076″ and place them in “output.csv” so the command was…
qgrep “476226235076″ inputs.csv > output.csv
Categories: Tools & Utilities Tags: command line, csv, flat files, text


