Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pereorga/csvshuf
Randomize cells within columns in a CSV file. Like GNU shuf, but for CSV.
https://github.com/pereorga/csvshuf
command-line command-line-tool console-application csv
Last synced: 29 days ago
JSON representation
Randomize cells within columns in a CSV file. Like GNU shuf, but for CSV.
- Host: GitHub
- URL: https://github.com/pereorga/csvshuf
- Owner: pereorga
- License: other
- Created: 2016-05-31T22:00:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-17T16:58:40.000Z (over 6 years ago)
- Last Synced: 2024-10-02T19:29:57.727Z (about 1 month ago)
- Topics: command-line, command-line-tool, console-application, csv
- Language: Python
- Homepage:
- Size: 25.4 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.md
Awesome Lists containing this project
README
csvshuf
=======Shuffle cells by column in CSV files.
Usage
-----.. code-block:: bash
usage: csvshuf [-h] [-s] [-c COLUMNS | -C NO_COLUMNS] [-d DELIMITER | -t]
[-q QUOTECHAR] [-o OUTPUT_DELIMITER] [-v]
[FILE]positional arguments:
FILE Input CSV file. If omitted, read standard input.optional arguments:
-s, --sattolo Use Sattolo shuffle algorithm.
-c COLUMNS, --columns COLUMNS
Comma-separated list of columns to include.
-C NO_COLUMNS, --no-columns NO_COLUMNS
Comma-separated list of columns to exclude.
-d DELIMITER, --delimiter DELIMITER
Input column delimiter.
-t, --tabbed Delimit input with tabs.
-q QUOTECHAR, --quotechar QUOTECHAR
Quote character.
-o OUTPUT_DELIMITER, --output-delimiter OUTPUT_DELIMITER
Output column delimiter.Examples
--------Shuffle the first column of foobar.csv
csvshuf -c1 foobar.csv
Shuffle the third column of foobar.csv using Sattolo's algorithm
csvshuf -c3 -s foobar.csv
Shuffle all columns of foobar.csv
csvshuf foobar.csv
Shuffle all the columns but the first of foobar.csv
csvshuf -C1 foobar.csv
Shuffle the first and third columns of the first ten lines of foobar.csv
head -10 foobar.csv | csvshuf -c 1,3
Shuffle the first and third columns of the pipe-delimited foobar.csv
csvshuf -c1,3 -d "|" foobar.csv
Shuffle the first and third columns of the tab-delimited foobar.csv
csvshuf -c 1,3 -t foobar.csv
Shuffle the first three columns of the pipe-delimited foobar.csv; output
will be comma-delimitedcsvshuf -c 1,2,3 -d "|" -o , foobar.csv
Shuffle the first three columns of the comma-delimited foobar.csv;
output will be pipe-delimitedcsvshuf -c 1,2,3 -o "|" foobar.csv
Shuffle the first two columns of the comma-delimited, pipe-quoted
foobar.csvcsvshuf -c 1,2 -d "," -q "|" foobar.csv
Installation
------------pip install csvshuf
or
pip3 install csvshuf
Author
------Pere Orga [email protected], 2016.
Originally forked from csvcut (https://gist.github.com/bycoffe/187278).