grep -P 'start: (\d+) end'
$ echo 'foobar start: 123 end quuxbar' | rg 'start: ([0-9]+) end' foobar start: 123 end quuxbar $ echo 'foobar start: 123 end quuxbar' | rg 'start: ([0-9]+) end' -r '$1' foobar 123 quuxbar $ echo 'foobar start: 123 end quuxbar' | rg 'start: ([0-9]+) end' -or '$1' 123
grep -oP 'start: \K\d+(?= end)'
If you need to process further, you can make use of `-r` option in `ripgrep` or move to other tools like sed, awk, perl, etc.