This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Pluck columns from csv files in the commandline. Like cut or awk, but without choking on delimiter escaping.

install

pip install pluckr. Done.

usage

Grab columns 2 and 3 from stdin (-f is one-indexed):

pluckr -f 2,3 < sample1.csv

Or straight from a file:

pluckr -f 2,1 sample1.csv

Your requested order is retained:

pluckr -f 1,2 sample1.csv != pluckr -f 2,1 sample1.csv

You can use Python’s negative indices… grab the first and last cols:

pluckr -f 1,-1 sample1.csv

And you can mix in ranges for column selection:

pluckr -f 2,4-6,9 sample1.csv

Can’t be sure which columns exist or what their indices are?

pluckr –names sample1.csv

Fields that don’t exist (e.g. -f11111) will be ignored.

Preprended line numbers can be helpful:

cat sample1.csv | pluckr –line-numbers

Skip header row(s):

cat sample1.csv | pluckr -s1

Grab all but the 2nd column (drop columns instead of selecting them):

pluckr -f 1 -i < sample2.csv

Read (and write) various delimiters:

pluckr -d, –out-delimiter=| < with-commas.csv > with-pipes.csv

Note that passing tabs as arguments can be awkward; in a pinch, use:

pluckr -d $’t’

help

Via --help:

usage: pluckr [-h] [-f FIELDS] [-i] [-d DELIMITER] [-q QUOTECHAR] [-s SKIP]
[-l] [-n] [infile]

Grab columns from csv input. http://github.com/philadams/pluckr

positional arguments:
infile input file (.csv)
optional arguments:
-h, --help show this help message and exit
-f FIELDS ordered list of columns to retain; one-indexed
-i, --inverse invert column retention: drop those in -f
-d DELIMITER, --delimiter DELIMITER
 field delimiter when reading infile
-q QUOTECHAR, --quotechar QUOTECHAR
 field quotechar when reading infile
-s SKIP, --skip SKIP
 number of rows to skip
-l, --line-numbers
 prepend line numbers to output
-n, --names print column names; assumes one header row

tests

This project uses [roundup](https://github.com/bmizerany/roundup) for testing. Run tests with make test.

future

  • allow -f to take columns by name when there’s a header row?
  • implement –out-x for output delimiters etc.
  • json output? or, contribute a cli to kennethreitz/tablib
  • add out delimiter support
  • add out quotechar support
Release History

Release History

0.0.9

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pluckr-0.0.9.tar.gz (3.7 kB) Copy SHA256 Checksum SHA256 Source Feb 27, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting