0
I have input with lines like this (it's a CIGAR string from sam format but it doesn't matter now):
123M76N55M4S
6M7N25M
32M488N
And I want to extract all the N's and preceding digits:
76N
7N
488N
I've tried this command:
sed -r 's/^.*([0-9]+N).*$/\1/'
But I get in the output only the last digit. How can I obtain all the preceding digits?