aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2023-01-28 20:49:50 -0500
committertdro <tdro@users.noreply.github.com>2023-01-28 20:49:50 -0500
commit7cdd8011455b628b4329eac3da7ce5733858c128 (patch)
tree84264b75dea93fd51b774d6f009f3999c7901203
parentbe46271fe22c464373c4ba1f8ce95374c3514533 (diff)
downloaddotfiles-7cdd8011455b628b4329eac3da7ce5733858c128.tar.gz
dotfiles-7cdd8011455b628b4329eac3da7ce5733858c128.tar.bz2
dotfiles-7cdd8011455b628b4329eac3da7ce5733858c128.zip
.local/bin/bashhistory: Remove lines beginning with tabs/spaces
Use one sed
-rwxr-xr-x.local/bin/bashhistory6
1 files changed, 3 insertions, 3 deletions
diff --git a/.local/bin/bashhistory b/.local/bin/bashhistory
index a0f8300..98f1d33 100755
--- a/.local/bin/bashhistory
+++ b/.local/bin/bashhistory
@@ -7,9 +7,9 @@ current="$HISTFILE"
lockfile='/tmp/bashhistory_Ri5ki9ei.lock'
_prune() {
- sed --in-place '/^#/d' "$1" && # Remove all timestamps.
- sed --in-place '/.........../!d' "$1" && # Remove all commands less than 11 characters.
- sort --unique "$1" > "$1.tmp" && mv --force "$1.tmp" "$1" > /dev/null 2>&1 # Remove all duplicate entries.
+ sed --in-place '/^#/d;/^ /d;/^\t/d;/.........../!d' "$1" && # Remove all timestamps, lines beginning with tabs/spaces, and commands less than 11 characters
+ sort --unique "$1" > "$1.tmp" && # Remove all duplicate entries.
+ mv --force "$1.tmp" "$1" > /dev/null 2>&1
}
_migrate() {