Skip to content

Print unique lines from a file. Similar to using something like '|sort|uniq', but without sorting.

License

Notifications You must be signed in to change notification settings

Lateralus138/onlyone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OnlyOne

LOGO


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


Twitter URL this project.

About

Description

Print unique lines from a file. Similar to using something like '|sort|uniq', but without sorting.

Motivation

  • 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 use fzf to search history.
  • I like to make my own utilities even if there are viable alternatives.

Development

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.

Usage

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.

File Permissions

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 

Installation

This program is portable, but there is a Debian (.deb file) package installer for the Linux binary version.

Debian Installer

The file: onlyone.deb is a Linux Debian package installer for use on most Linux Debian based operating systems.

Install By (Double) Clicking

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 Command Line Method

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:

Uninstall Command Line Method
sudo apt remove onlyone
# -y to skip prompt approval

Portable Usage

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
Operating System PATH

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%

Environment Usage

Used in many command lines across 3 main operating systems (and more).

Operating System Environment

3 main operating systems:

  • Linux
  • Windows
  • MacOs

Command Line Environment

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.

Examples

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.

Links

All links pertinent to this project.

All of the most current, up-to-date files are located on the 'Stable Release' page.

Project Links

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

File Links

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

Project Status

Overall Status

Description Status
Project Release Date GitHub Release Date
Total downloads for this project GitHub all releases
Complete repository size This Repo Size
Commits in last month GitHub commit activity
Commits in last year GitHub commit activity

Latest Version Status

Description Status
Release version Release Version
Tag version Tag Version
Total downloads for current version GitHub release (latest by date)

Latest Build Status

Name Status Code Quality
Linux: Build/Publish OnlyOne - Rust Build - Linux
Debian: Build/Publish OnlyOne - Rust Build - Debian
Windows: Build/Publish OnlyOne - Rust Build - Windows
Macos: Build/Publish OnlyOne - Rust Build - Macos

Media

Logo

Main Logo

Screen Shots

Help Screen

Help Screen

Demo Screen

Demo Screen

License Info

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.

About

Print unique lines from a file. Similar to using something like '|sort|uniq', but without sorting.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages