4 ms·
-rcvs Load the (built-in) CSV module in Ruby. -e Eval the following string as Ruby code. CSV($<) Create CSV parser with standard input `$<` as the
by LispSporks22 3y ago
-rcvs
Load the (built-in) CSV module in Ruby.
-e
Eval the following string as Ruby code.
CSV($<)
Create CSV parser with standard input `$<` as the source.
.each
Run the code in the block that follows for each row (automatically skips the CSV header):
{ |r| puts r[0] }
For a row, print the first/0th element. Can be simplified in recent Ruby:
{ puts _1[0] }
- afefers 3y agoThank you so much! This got me looking at the Ruby documentation about blocks. Very cool feature!