Created
September 3, 2008 02:19
-
-
Save snaka/8521 to your computer and use it in GitHub Desktop.
Filter for excel csv file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Excel cvs file filter | |
# usage : ruby cvs_filter.rb input.csv column_no word | |
# | |
require "csv" | |
col_names = nil | |
CSV.open(ARGV[0], 'r') do |row| | |
unless col_names | |
STDOUT << CSV.generate_line(row) + "\n" | |
col_names = row | |
end | |
STDOUT << CSV.generate_line(row) + "\n" if row[ARGV[1].to_i].data.include?(ARGV[2]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment