Skip to content

Instantly share code, notes, and snippets.

@vitaliel
Created September 15, 2009 08:43
Show Gist options
  • Save vitaliel/187183 to your computer and use it in GitHub Desktop.
Save vitaliel/187183 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# Usage:
# ruby extract_l.rb cc.csv ids.txt > new_cc.csv
lines = IO::readlines(ARGV[0]).map {|x| x.chomp! }
ids = IO::readlines(ARGV[1]).map {|x| x.chomp! }
lines.shift
for l in lines
id, _, = l.split /,/, 2
if ids.include?(id)
puts l
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment