Skip to content

dates mask in -g #2989

Answered by BurntSushi
QuAzI asked this question in Q&A
Discussion options

You must be logged in to vote

The -g/--glob flag just accepts a glob. I don't see why it should have knowledge about datetimes.

On Unix, I would do something like this: rg --files | rg '[0-9]{4}-[0-9]{2}-(10|11|12|13|14).md' | xargs rg -N --sort path '^(#+\s+)' -r ' '. If your file paths have spaces in them, you'd need some -0 and --null-data flags in there too I imagine.

I don't know if Windows has an equivalent to xargs, but it's insanely useful for this sort of thing.

If you need a portable program to emit dates, you can consider using Jiff in a Rust program. Drop this in a directory in a file named main.rs:

use jiff::{civil::Weekday, ToSpan, Zoned};

fn main() -> anyhow::Result<()> {
    let monday = Zoned::now().t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants