| 1 |
Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013, 2014, 2015, |
| 2 |
2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
Copyright (C) 2013-2021 Assaf Gordon <[email protected]> |
| 5 |
Copyright (C) 2022-2025 Timothy Rice <[email protected]> |
| 6 |
|
| 7 |
Copying and distribution of this file, with or without modification, |
| 8 |
are permitted in any medium without royalty provided the copyright |
| 9 |
notice and this notice are preserved. |
| 10 |
|
| 11 |
GNU Datamash |
| 12 |
============ |
| 13 |
|
| 14 |
GNU Datamash is a command-line program which performs basic |
| 15 |
numeric,textual and statistical operations on input textual data files. |
| 16 |
|
| 17 |
it is designed to be portable and reliable, and aid researchers |
| 18 |
to easily automate analysis pipelines, without writing code or even |
| 19 |
short scripts. |
| 20 |
|
| 21 |
Home page: https://www.gnu.org/software/datamash |
| 22 |
|
| 23 |
|
| 24 |
Usage |
| 25 |
===== |
| 26 |
|
| 27 |
See `datamash --help` for basic usage information. |
| 28 |
|
| 29 |
See `man datamash` for examples and operation details. |
| 30 |
|
| 31 |
For the instrucions manual, see `info datamash` or visit |
| 32 |
https://www.gnu.org/software/datamash/manual/ |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
Examples |
| 37 |
======== |
| 38 |
|
| 39 |
What's the sum and mean of the values in field 1 ? |
| 40 |
|
| 41 |
$ seq 10 | datamash sum 1 mean 1 |
| 42 |
55 5.5 |
| 43 |
|
| 44 |
Given a file with three columns (Name, College Major, Score), |
| 45 |
what is the average, grouped by college major? |
| 46 |
|
| 47 |
$ cat scores.txt |
| 48 |
John Life-Sciences 91 |
| 49 |
Dilan Health-Medicine 84 |
| 50 |
Nathaniel Arts 88 |
| 51 |
Antonio Engineering 56 |
| 52 |
Kerris Business 82 |
| 53 |
... |
| 54 |
|
| 55 |
|
| 56 |
# Sort input and group by column 2, calculate average on column 3: |
| 57 |
|
| 58 |
$ datamash --sort --group 2 mean 3 < scores.txt |
| 59 |
Arts 68.9474 |
| 60 |
Business 87.3636 |
| 61 |
Health-Medicine 90.6154 |
| 62 |
Social-Sciences 60.2667 |
| 63 |
Life-Sciences 55.3333 |
| 64 |
Engineering 66.5385 |
| 65 |
|
| 66 |
See more examples at https://www.gnu.org/software/datamash/examples/ |
| 67 |
|
| 68 |
|
| 69 |
Download and Installation |
| 70 |
========================= |
| 71 |
|
| 72 |
Download the latest source code at https://www.gnu.org/software/datamash . |
| 73 |
|
| 74 |
General installation commands: |
| 75 |
|
| 76 |
$ tar -xzf datamash-[VERSION].tar.gz |
| 77 |
$ cd datamash-[VERSION] |
| 78 |
$ ./configure |
| 79 |
$ make |
| 80 |
$ make check |
| 81 |
$ sudo make install |
| 82 |
|
| 83 |
Also see INSTALL. |
| 84 |
|
| 85 |
See Platform/OS-specific download instructions at |
| 86 |
https://www.gnu.org/software/datamash/download/ |
| 87 |
|
| 88 |
|
| 89 |
To build from latest git sources, see the HACKING.md file. This file is |
| 90 |
available when cloning from git, but is not distributed in the tar archive. |
| 91 |
To clone the git repository run |
| 92 |
git clone git://git.savannah.gnu.org/datamash.git |
| 93 |
It is also available online at |
| 94 |
https://git.savannah.gnu.org/cgit/datamash.git/tree/HACKING.md |
| 95 |
|
| 96 |
|
| 97 |
BASH Auto-completion |
| 98 |
==================== |
| 99 |
|
| 100 |
The datamash package inclueds a bash auto-completion script. |
| 101 |
The installation location can be controlled using |
| 102 |
|
| 103 |
./configure --with-bash-completion-dir=[no|local|global|PATH] |
| 104 |
|
| 105 |
The options are: |
| 106 |
|
| 107 |
* local - install under the package's $PREFIX path. |
| 108 |
typically `/usr/local/share/datamash/bash-completion.d/` , |
| 109 |
but can be changed with `./configure --prefix`. |
| 110 |
This is the default. |
| 111 |
|
| 112 |
* no - do not install the bash completion script. |
| 113 |
|
| 114 |
* [PATH] - install into the PATH specified on the command line, e.g. |
| 115 |
`./configure --with-bash-completion-dir=/for/bar/bash-completion.d/` |
| 116 |
|
| 117 |
* global - install into the system's global bash-completion directory, |
| 118 |
as reported by `pkg-config`. This will be the result of: |
| 119 |
`pkg-config --variable=completionsdir bash-completion` |
| 120 |
Which is commonly `/usr/share/bash-completion/completions` |
| 121 |
or `/etc/bash.d`. |
| 122 |
If `pkg-config` is not found or if `pkg-config` does not have |
| 123 |
the config (.pc) file for the bash-completion package, |
| 124 |
defaults to 'local'. |
| 125 |
|
| 126 |
`local` is the default, and should be used particularly if installing under |
| 127 |
a non-default `--prefix` without root permissions. |
| 128 |
`global` should be used if you are installing to default location (/usr/local) |
| 129 |
and have root permissions (e.g. `sudo make install`). |
| 130 |
Using custom PATH or `global` should be used when packaging datamash for |
| 131 |
further distribution. |
| 132 |
|
| 133 |
Questions and Bug Reports |
| 134 |
========================= |
| 135 |
|
| 136 |
- Please send questions and bug reports to [email protected] . |
| 137 |
- Searchable archive at https://lists.gnu.org/archive/html/bug-datamash . |
| 138 |
- Subscribe at https://lists.gnu.org/mailman/listinfo/bug-datamash . |
| 139 |
|
| 140 |
|
| 141 |
Copyright and License |
| 142 |
===================== |
| 143 |
Copyright (C) 2013-2021 Assaf Gordon <[email protected]> |
| 144 |
|
| 145 |
License: GPL Version 3 (or later). See COPYING. |
| 146 |
|
| 147 |
For any copyright year range specified as YYYY-ZZZZ in this package |
| 148 |
note that the range specifies every single year in that closed interval. |