diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-11-20 13:51:18 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-11-20 13:51:18 +1300 |
commit | 66b2b2612732e6782f5ed598361e0cc7ee061e7e (patch) | |
tree | 67d0a80797fb8bd1054d540d84a6dfba0d331b8b | |
parent | Resolve a shellcheck issue (diff) | |
download | dotfiles-66b2b2612732e6782f5ed598361e0cc7ee061e7e.tar.gz dotfiles-66b2b2612732e6782f5ed598361e0cc7ee061e7e.zip |
Add ddup(1df)
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | README.markdown | 1 | ||||
-rw-r--r-- | bin/ddup.awk | 2 | ||||
-rw-r--r-- | foo | 4 | ||||
-rw-r--r-- | man/man1/ddup.1df | 20 |
6 files changed, 32 insertions, 2 deletions
@@ -1,3 +1,4 @@ +bin/ddup bin/han bin/mean bin/med @@ -66,7 +66,8 @@ EMAIL := tom@sanctum.geek.nz KEY := 0xC14286EA77BB8872 SENDMAIL := msmtp -all : bin/han \ +all : bin/ddup \ + bin/han \ bin/mean \ bin/med \ bin/mftl \ @@ -83,6 +84,7 @@ all : bin/han \ clean distclean : rm -f \ + bin/ddup \ bin/han \ bin/mean \ bin/med \ @@ -181,7 +183,7 @@ install-bash-completion : install-bash install -pm 0644 -- bash/bash_completion "$(HOME)"/.config/bash_completion install -pm 0644 -- bash/bash_completion.d/* "$(HOME)"/.bash_completion.d -install-bin : bin/han bin/mean bin/med bin/mftl bin/mode bin/rfct \ +install-bin : bin/ddup bin/han bin/mean bin/med bin/mftl bin/mode bin/rfct \ bin/rndi bin/sd2u bin/slsf bin/su2d bin/tot bin/unf install-bin-man install -m 0755 -d -- "$(HOME)"/.local/bin for name in bin/* ; do \ diff --git a/README.markdown b/README.markdown index 13b6737e..1dd1643c 100644 --- a/README.markdown +++ b/README.markdown @@ -417,6 +417,7 @@ Installed by the `install-bin` target: * `clrd(1df)` sets up a per-line file read, clearing the screen first. * `clwr(1df)` sets up a per-line file write, clearing the screen before each line +* `ddup(1df)` removes duplicate lines from unsorted input. * `dmp(1df)` copies a pass(1) entry selected by `dmenu(1)` to the X CLIPBOARD. * `dub(1df)` lists the biggest entries in a directory. diff --git a/bin/ddup.awk b/bin/ddup.awk new file mode 100644 index 00000000..28b4d135 --- /dev/null +++ b/bin/ddup.awk @@ -0,0 +1,2 @@ +#!/usr/bin/awk -f +!seen[$0]++ @@ -0,0 +1,4 @@ +a +b +c +d diff --git a/man/man1/ddup.1df b/man/man1/ddup.1df new file mode 100644 index 00000000..ca5e35a0 --- /dev/null +++ b/man/man1/ddup.1df @@ -0,0 +1,20 @@ +.TH DDUP 1df "November 2016" "Manual page for ddup" +.SH NAME +.B ddup +\- remove duplicates from unsorted output +.SH USAGE +.B ddup +FILE1 [FILE2 ...] +.br +.B ddup +< FILE +.br +program | +.B ddup +.SH DESCRIPTION +.B ddup +removes duplicate lines from the input without requiring it to be sorted. +Because it caches each unique line, this is less efficient than using sort(1) +and then uniq(1), but necessary if maintaining the order is desirable. +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |