I need to extract certain pieces from a string, wher delimiters may vary. For example
A0 B0 C0 12345677 X0 Y0 Z0
A1-B1 C1 12345678 X1 Y0 Z0
A1/B2 C77 12345679 X2 Y0 Z0
I need to get
C0 12345677 X0
C1 12345678 X1
C77 12345679 X2
I tried sed, see example below:
echo 'A0 B0 C0 12345 X0 Y0 Z0 '|sed -n '/B0/,/X0/p'
But it is not right, the result is the whole line, like this
A0 B0 C0 12345 X0 Y0 Z0
Fixed length solution like cut -c ... is not applicable here.
Any pointers will be appreciated.