To extract line 25706 from a csv file and pretty-print it:
sed -n "1p;25706p" MyFile.csv | csv
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'bundler' | |
| Bundler.setup | |
| require 'csv' | |
| require 'awesome_print' | |
| if STDIN.tty? | |
| puts 'your_command | csv' | |
| else | |
| CSV.parse(STDIN.read, :headers => true) do |row| | |
| ap row.to_hash | |
| end | |
| end |
Good call - the 'ap' one is legacy from before the gem changed name. Updating!
require 'awesome_print'instead'ap'no ?