cut command

I have to cut a string using a multiple character delimiter.

I use -d'XP_' -f2
But delimiter is invalid ???? :mad:

( I have tried -d 'XP_' or -d"XP_" or -d "XP_" . Same error :mad:

Any idea, someone to help.

Hi ,

cut -f 2 -d XP_

normally it takes the second field and put "XP_" as separator

this is what you want ?

Christian

a=TEXT_TEXT_XP_4.3.2A ( I'd like to extract 4.3.2A )

I'm typing :
echo $a |cut -f2 -d XP_

and error is cut:invalid delimiter

I've become
cut: the delimiter must be a single character (GNU cut 5.3.0)
Try sed or something like it

$ echo TEXT_TEXT_XP_4.3.2A | sed -e 's/^.*XP_//'

From cut manual:

For your specific problem you could use:

echo "TEXT_TEXT_XP_4.3.2A" | cut -d_ -f4