Python at the Prompt

February 19, 2012 by Gabe | [mmd] |

Pyp (short for Pyed Piper) is a project to enable python text processing at the unix prompt. I suck at sed and AWK but I suck less at Python so I think this looks interesting. I wish there was a Windows equivalent to work with CMD commands. If anything could use some help, it's the Windows CMD interface.

The module supports standard Python string processing but also includes some built in variables for accessing strings from the shell.

The "p" variable processes each line of the shell output while "pp" processes the entire block as one string. There are several interesting examples available through the module home.

Here's what I did to install the command on my Mac:

  1. Download the file and place it in the /usr/local/bin directory.
  2. Set the permissions to include execute (755 should work)
  3. Have fun

I learned something else interesting while reading about this module. Sony's Imageworks has several really amazing open source projects. They were all developed to address internal needs and eventually released to the public.