Extract string between strings using grep/sed

msg="Overlapping blocks found during reloadBlocks" detail="[mint: 1615752000000, maxt: 1615759180001, range: 1h59m40s, blocks: 2]: <ulid: 01F4N20ECMTEAK47DT3A6CSVPW, mint: 1615752000000, maxt: 1615759180001, range: 1h59m40s>, <ulid: 01F42H5XRTFJZP0CGAQP2YHDB7, mint: 1615752000000, maxt: 1615759180001, range: 1h59m40s>\n[mint: 1615759200000, maxt: 1615762780001, range: 59m40s, blocks: 2]: <ulid: 01F4N20WGMS1RX8ZV2A3PZQQQK, mint: 1615759200000, maxt: 1615762780001, range: 59m40s>, <ulid: 01F42H6EE2T7S688XAF14K5WKF, mint: 1615759200000, maxt: 1615766380001, range: 1h59m40s>\n[mint: 1615723200000, maxt: 1615730380001, range: 1h59m40s, blocks: 2]: <ulid: 01F42H3ZXFFMRC5108FXKZPN2X, mint: 1615723200000, maxt: 1615730380001, range: 1h59m40s>, <ulid: 01F4N1YEY1BAPF87PFFKK337DX, mint: 1615723200000, maxt: 1615730380001, range: 1h59m40s>\n[mint: 1615730400000, maxt: 1615737580001, range: 1h59m40s, blocks: 2]: <ulid: 01F4N1YXR9NQ6VXNC42V5XPVGX, mint: 1615730400000, maxt: 1615737580001, range: 1h59m40s>, <ulid: 01F42H4GR1BWBC2TEGHECV9WZ7, mint: 1615730400000, maxt: 1615737580001, range: 1h59m40s>\n[mint: 1615744800000, maxt: 1615751980001, range: 1h59m40s, blocks: 2]: <ulid: 01F4N1ZZAE9DSXJDCBCFTSQ1QW, mint: 1615744800000, maxt: 1615751980001, range: 1h59m40s>, <ulid: 01F42H5F8A0K6X6XAK1WSA314A, mint: 1615744800000, maxt: 1615751980001, range: 1h59m40s>"

msg="Found overlapping blocks during compaction" ulid=01F4T0FFTFMHW44712M75NTHBW

I have logs like these and would like to find all ulids. Some logs have the format ulid: <id>, and others have ulid=<id>. A line can have multiple ulids.



Read more here: https://stackoverflow.com/questions/67376023/extract-string-between-strings-using-grep-sed

Content Attribution

This content was originally published by pdna at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: