Ruby One Liners

November 16th, 2005

ruby oneliners. Ever come across the sed oneliners page by Eric Pement? This is a really handy list of quick sed commands for common tasks. Two nights ago, I started practicing my Ruby CLI by emulating the commands in sed. Partly to exercise ruby and partly to compare the two tools. Six hours later, I ended up completely mapping them all to ruby. Hopefully someone will find them as useful as I do. I think about half of the tasks are better suited for one tool or the other; ruby replaces some of sed’s extremely terse (but powerful) commands. Though, sed wins with extreme brevity in some cases. In all, I’ll take readability andreproducibility over terseness.

Comments are closed.