Snippet: col

April 20, 2008 | Tags: ruby snippet
#!/usr/bin/env ruby
col = ARGV.pop.to_i-1
while line = gets
  puts line.chomp.split(/\s+/)[col]
end

And because I can never remember the standard unix tool that does the same thing, and awk is awkward.

blog comments powered by Disqus