Let's say I have a string and its contents are US1SERVLOC2
. I want to be able to get the strings US1
and LOC2
from that string.
echo "US1SERVLOC2" | cut -f1 -d 'SERV'
echo "US1SERVLOC2" | cut -f2 -d 'SERV'
I originally tried this but cut doesn't like delimiters that aren't single characters. How do I accomplish this?