The Problem
I multiple Markdown files in a folder, formatted like so...
# Cool Project
* Random Text
* Other information
TODO: This is a task
TODO: This is another task
And I've written a script that pulls out all the strings that start with TODO from all the files...
ag TODO: ~/myfolder/journal | sed 's/(^.*:)(.*)/TODO:2 /g' | sed ''/TODO:/s//`printf "33[35mTODO:33[0m"`/'' | sed ''s/![a-zA-Z0-9]*/$(printf "33[31;1m&33[0m")/''
and this gives me an output like this
TODO: This is a task
TODO: This is another task
I was wondering if it would be possible to look backward from the pattern using sed to identify and pickup the line that starts with /^# /
and appended it to the end of the string... something like this
TODO: This is a task # Cool Project
TODO: This is another task # Cool Project
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…