There is a string, which contains numbers and letters in its name. The symbol '_' divides different parts of the string.
X23X_1XY4_XXXX_Y12Y_YYX2_XXYY
I want to have only second, third and forth parts:
1XY4_XXXX_Y12Y
Using cut one can do:
echo 'X23X_1XY4_XXXX_Y12Y_YYX2_XXYY' | cut -d'_' -f2,3,4
How to do it with sed?
One way would be to use capture groups:
For delimited data, awk is often simpler: