diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2023-06-18 11:36:20 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2023-06-18 11:36:20 +0800 |
commit | c1e2b436a00117af6c63daa7f2716f4ae0038d80 (patch) | |
tree | 3439aa06a96af41c6c1cad0692b3b7e2354e8677 /bin | |
parent | 994be20d5ed1019cac3b2157b0a154727bf2abbf (diff) |
Update
Diffstat (limited to 'bin')
-rw-r--r-- | bin/log/shellrc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/log/shellrc b/bin/log/shellrc index 721ed1b..a39e291 100644 --- a/bin/log/shellrc +++ b/bin/log/shellrc | |||
@@ -10,3 +10,12 @@ alias dia='diary' | |||
10 | alias dias='diary specify' | 10 | alias dias='diary specify' |
11 | alias diaa='diary print' | 11 | alias diaa='diary print' |
12 | alias diat='diary today' | 12 | alias diat='diary today' |
13 | |||
14 | # Filter frontmatter | ||
15 | wf() { | ||
16 | grep -m1 --include='*md' -n -o "$@" -R ~/log | \ | ||
17 | while IFS=: read file number pattern; do | ||
18 | end_of_frontmatter=$(grep -m2 -n -P '\-\-\-' $file | sed -n 2p | cut -d: -f1) | ||
19 | [ $number -lt "${end_of_frontmatter:-0}" ] && echo $file | ||
20 | done | ||
21 | } | ||