Guest User

Untitled

a guest
Feb 19th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. # Excel cvs file filter
  2. # usage : ruby cvs_filter.rb input.csv column_no word
  3. #
  4.  
  5. require "csv"
  6.  
  7. col_names = nil
  8.  
  9. CSV.open(ARGV[0], 'r') do |row|
  10. unless col_names
  11. STDOUT << CSV.generate_line(row) + "\n"
  12. col_names = row
  13. end
  14.  
  15. STDOUT << CSV.generate_line(row) + "\n" if row[ARGV[1].to_i].data.include?(ARGV[2])
  16. end
Add Comment
Please, Sign In to add comment