Note: New Version
This project is now redundant as it's been replaced by a 2nd version. You can still use this if you like, but the recommended version where you'll find more support will be the 2nd version.
This has been re-written in C++ with a new feature (switch) for case insensitivity and the ability to read piped stdin or from passed arguments.
New Version
https://github.com/Lateralus138/onlyonev2
Print unique lines from a file. Similar to using something like '|sort|uniq', but without sorting.
- I wanted a better solution than
|sort|uniq
to get unique lines from a file. I use this to truncate .bash_history especially since I usefzf
to search history. - I like to make my own utilities even if there are viable alternatives.
This program is written in the programming language Rust and maintained, built, and tested here at this GitHub repository and pre-built and pre-tested on personal Linux and Windows machines.
This is a cross-platform command line tool in binary executable format that can be used in command lines/consoles/terminals/ttys/shells in Linux, Windows, and MacOs.
This program's name has various versions, but they should all be renamed to: onlyone
.
The main program file is meant to be executable and in Windows that's not usually an issue, but in Linux and MacOs you may need to set the permissions.
In a Linux or MacOs command line run:
# executable for all users
chmod +x /path/to/onlyone
# or
chmod 755 /path/to/onlyone
# executable for current user only
chmod u+x /path/to/onlyone
This program is portable, but there is a Debian (.deb file) package installer for the Linux binary version.
The file: onlyone.deb is a Linux Debian package installer for use on most Linux Debian based operating systems.
Like many other executable files this should be able to be clicked or double clicked to execute and it should open in the systems software manager gui.
Install from command line with:
sudo dpkg -i /path/to/onlyone.deb
I imagine this can be installed with gdebi, but I'm not familiar with it.
Uninstall with:
sudo apt remove onlyone
# -y to skip prompt approval
Portable applications do not need to be installed, but they are easier to use if they are in one of a systems PATH
directories.
If the program file is not in PATH
(or in the current directory) then you must run it with the complete path url:
/path/to/onlyone --help
or
& '\Path\To\onlyone.exe' --help
If the file is place in PATH
then you can run it with:
onlyone --help
PATH
directories are stored and can listed in the various operating systems PATH
variable.
E.g.
echo "$PATH"
Operating System | Variable Name |
---|---|
Linux | $PATH |
MacOs | $PATH |
Windows | %PATH% |
Used in many command lines across 3 main operating systems (and more).
3 main operating systems:
- Linux
- Windows
- MacOs
Used in any command line environment from Linux Shell to Windows PowerShell.
- Windows
- CMD
- PowerShell
- Linux
- Shell
- Bash
- Zsh
- many more...
- MacOs
- Same as Linux I imagine.
Get unique lines in a file:
$ # first read file.txt contents
$ cat file.txt
line 1
line 1
line 2
line 2
line 3
line 3
line 3
$ # get unique lines
$ onlyone file.txt
line 1
line 2
line 3
Get unique line count:
$ cat file.txt|wc -l
9
$ onlyone file.txt|wc -l
4
Help:
$ onlyone --help
Print unique lines.
E.g. onlyone /path/to/file
@USAGE:
onlyone FILE...
onlyone [OPTIONS...]...
onlyone [OPTIONS...]... FILE...
@FILE:
File Any file to read.
@OPTIONS:
-h,--help This HELP message.
@ERRORS: Integers - Exit Codes.
0 No errors.
1 No parameters passed.
2 No valid file passed.
3 Path does not exist.
4 Could not read file.
5 No lines in file.
6 Error while reading line.
All links pertinent to this project.
All of the most current, up-to-date files are located on the 'Stable Release' page.
Current project links.
Description | Link |
---|---|
Main repository. | https://github.com/Lateralus138/onlyone |
Main repository - themed version. | https://lateralus138.github.io/onlyone |
Current Releases | https://github.com/Lateralus138/onlyone/releases |
Stable Release | https://github.com/Lateralus138/onlyone/releases/tag/1.0.0.0 |
Current release files.
These are all the files included under 'Stable Release' on the 'Current Releases' page.
File Name | Description | Link |
---|---|---|
onlyone.deb | Debian package installer. | ./target/release/onlyone.deb |
onlyone_linux | Main Linux executable. | ./target/release/onlyone_linux |
onlyone_darwin | Main MacOS executable. | .target/release/onlyone_darwin |
onlyone_windows.exe | Main Windows executable. | ./target/release/onlyone_windows.exe |
Description | Status |
---|---|
Project Release Date | |
Total downloads for this project | |
Complete repository size | |
Commits in last month | |
Commits in last year |
Description | Status |
---|---|
Release version | |
Tag version | |
Total downloads for current version |
Name | Status | Code Quality |
---|---|---|
Linux: Build /Publish |
||
Debian: Build /Publish |
||
Windows: Build /Publish |
||
Macos: Build /Publish |
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
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 General Public License for more details.