Skip to content

Instantly share code, notes, and snippets.

@noromanba
Created May 1, 2017 22:52
Show Gist options
  • Save noromanba/f38da1706a55f08b53ae5ea57aca49ff to your computer and use it in GitHub Desktop.
Save noromanba/f38da1706a55f08b53ae5ea57aca49ff to your computer and use it in GitHub Desktop.
unsorted uniq w/ remove trailing spaces
#!/usr/bin/env bash
# unsorted uniq w/ remove trailing spaces
# @version 2017.4.29.0
# @license CC0 Univ PD https://creativecommons.org/publicdomain/zero/1.0/
# @author noromanba
# require sponge(1) provided w/ moreutils
set -euC
for file in "$@"
do
sed 's/\s\+$//' "$file" | awk '!x[$0]++' | sponge "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment