From 7cdd8011455b628b4329eac3da7ce5733858c128 Mon Sep 17 00:00:00 2001 From: tdro Date: Sat, 28 Jan 2023 20:49:50 -0500 Subject: .local/bin/bashhistory: Remove lines beginning with tabs/spaces Use one sed --- .local/bin/bashhistory | 6 +++--- 1 file 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() { -- cgit v1.2.3