#!/usr/bin/env ruby # like map(), except on shell pipelines # one arg: the mapper # transform input lines, via the mapper, into output lines # mapper is eval'd within the input line string # # extract 2nd column # cat file | map 'split[1]' # normalize url's # cat kinda-urls | map 'if self !~ %r[^http://] then "http://#{self}" else self; end' # designed for dotfiles.org/~brendano/.irbrc if File.exists?("#{ENV['HOME']}/.irbrc") $irbrc_extensions_only = true load "~/.irbrc" end cmd = ARGV.join(" ") STDIN.each do |line| puts line.chomp.instance_eval { eval cmd } end