diff options
author | tdro <tdro@users.noreply.github.com> | 2023-01-28 20:49:50 -0500 |
---|---|---|
committer | tdro <tdro@users.noreply.github.com> | 2023-01-28 20:49:50 -0500 |
commit | 7cdd8011455b628b4329eac3da7ce5733858c128 (patch) | |
tree | 84264b75dea93fd51b774d6f009f3999c7901203 | |
parent | be46271fe22c464373c4ba1f8ce95374c3514533 (diff) | |
download | dotfiles-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/bashhistory | 6 |
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() { |