diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-03-12 18:44:39 +0100 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-03-12 18:44:39 +0100 |
commit | 84ac9a70cc70272ee181aa0a3e0276fc8de673fd (patch) | |
tree | ef096b2f6bec78782792a841481501eed83ba3dc /bin/common/whenpkgs | |
parent | fab8d61418e2652881a56b586588f3373df5f971 (diff) |
added more guiscripts
Diffstat (limited to 'bin/common/whenpkgs')
-rwxr-xr-x | bin/common/whenpkgs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/common/whenpkgs b/bin/common/whenpkgs new file mode 100755 index 0000000..96c45d0 --- /dev/null +++ b/bin/common/whenpkgs @@ -0,0 +1,30 @@ +#!/bin/sh + +m="$(date +%m)" +d="$(date +%d)" +y="$(date +%y)" + +# Trying to make a regex that will match expac's date format + +# 1. create ranges based on command line arguments +# 2. change this to \(n-2\|n-1\|n\) +# I. generate sequence +# II. remove trailing space +# III.translate space to '\|' +# IV. wrap everything in '\( ... \)' +# V. shift command line arguments +# repeat 2. for month and year +# 3. seq outputs a newline, translate this to slash +# 4. remove trailing slash +regex="$(for var in m d y +do + seq -w -s ' ' $((${!var} - ${1:-0})) ${!var} | + sed 's/ /\\|/g;s/.*/\\(&\\)/' + shift 2>/dev/null +done | + tr '\n' '/' | + sed 's/.$//')" + +expac -t %D '%l %n' | + grep "$regex" | + sort -k 2 -t '/' -n |