Hi Daniel,
On Fri, 11 May 2018 16:16:52 -0700
Daniel Frey <djqf...@gmail.com> wrote:
[…]
Does anyone have a quick tip for my tired brain to make this work and
just output a blank line if there's no match? I swear I did this months
ago and had something working but I apparently didn't bother saving the
script I made. Argh!
if you can ensure there is only one four-digit year per line, try to
strip all other line characters with:
$ sed -e 's/.*\([0-9]\{4\}\).*/\1/' /path/to/your-date-file
while keeping none matching lines as they are. Note, pattern is always
greedy and picks up the last year it founds.
--
Regards,
floyd