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