Skip to content

awk-utilities/column-uniquely-sorted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Column Uniquely Sorted

Collects and sorts unique columns

Byte size of Column Uniquely Sorted Open Issues Open Pull Requests Latest commits



Requirements

This project was tested with GNU flavored Awk, AKA gawk; before opening new Issues please ensure that version 4.1.4 or greater is installed...

  • Arch based Operating Systems
sudo packman -Syy

sudo packman -S gawk git make
  • Debian derived Distributions
sudo apt-get update

sudo apt-get install gawk git make

Quick Start

Perhaps as easy as one, 2.0,...


Clone

Clone this project...

mkdir -vp ~/git/hub/awk-utilities

cd ~/git/hub/awk-utilities

git clone git@github.com:awk-utilities/column-uniquely-sorted.git

Install

Project script(s) and manual page(s) may be installed via make install command...

cd ~/git/hub/awk-utilities/column-uniquely-sorted

make install

Uninstall

Script(s) and manual page(s) for this project may be uninstalled via uninstall Make target...

cd ~/git/hub/awk-utilities/column-uniquely-sorted

make uninstall

Upgrade

To update in the future use make upgrade command...

cd ~/git/hub/awk-utilities/column-uniquely-sorted

make upgrade

Documentation

After installation documentation may be accessed via man command, eg...

man column-uniquely-sorted.awk

Usage

Linux based distributions with MAwk, GAwk, and/or Awk installed generally may run Awk scripts directly, eg...

script_name.awk --param=value input_file.ext

... However, some systems do not have the Awk executable linked to /usr/bin/awk file path, in such cases Awk scripts must be invoked via...

awk -f script_name.awk --param=value input_file.ext

Examples

file-one.txt

foo
bar
spam
ham

file-two.txt

foo
lamb
spam
ham

By default the column-uniquely-sorted.awk script will sort unique lines, not just an individual column...

column-uniquely-sorted.awk file-one.txt file-two.txt
#> bar
#> foo
#> ham
#> lamb
#> spam

And it is possible to instead sort by count, as well as reverse sort order...

column-uniquely-sorted.awk --count\"
                           --reverse\" 
                           file-one.txt\
                           file-two.txt
#> 2 spam
#> 2 ham
#> 2 foo
#> 1 lamb
#> 1 bar

API

Available command-line options

  • --blank <string> - Blank line identifier, if undefined then blank lines/columns are ignored

  • --column <number> - Selected column to collect, count, and sort. Default 0

  • --count - Sorts by count if defined

  • --usage - Prints help message and exits

  • --reverse - Reverse sorted output

  • --version - Prints version for this script and exits\n


Notes

The column-uniquely-sorted.awk script requires that sufficient memory is available for all parsed entries.

Currently blank/empty lines are not counted or sorted.

This repository may not be feature complete and/or fully functional, Pull Requests that add features or fix bugs are certainly welcomed.


Contributing

Options for contributing to column-uniquely-sorted and awk-utilities


Forking

Start making a Fork of this repository to an account that you have write permissions for.

  • Add remote for fork URL. The URL syntax is git@github.com:<NAME>/<REPO>.git...
cd ~/git/hub/awk-utilities/column-uniquely-sorted

git remote add fork git@github.com:<NAME>/column-uniquely-sorted.git
  • Commit your changes and push to your fork, eg. to fix an issue...
cd ~/git/hub/awk-utilities/column-uniquely-sorted


git commit -F- <<'EOF'
:bug: Fixes #42 Issue


**Edits**


- `<SCRIPT-NAME>` script, fixes some bug reported in issue
EOF


git push fork main

Note, the -u option may be used to set fork as the default remote, eg. git push -u fork main however, this will also default the fork remote for pulling from too! Meaning that pulling updates from origin must be done explicitly, eg. git pull origin main

  • Then on GitHub submit a Pull Request through the Web-UI, the URL syntax is https://github.com/<NAME>/<REPO>/pull/new/<BRANCH>

Note; to decrease the chances of your Pull Request needing modifications before being accepted, please check the dot-github repository for detailed contributing guidelines.


Sponsor

Thanks for even considering it!

Via Liberapay you may sponsor__shields_io__liberapay on a repeating basis.

Regardless of if you're able to financially support projects such as column-uniquely-sorted that awk-utilities maintains, please consider sharing projects that are useful with others, because one of the goals of maintaining Open Source repositories is to provide value to the community.


Attribution


License

Collects and sorts unique columns
Copyright (C) 2021 S0AndS0

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

For further details review full length version of AGPL-3.0 License.