canecse canecse - 1 month ago 9x
Bash Question

How to cut a string after a specific character in unix

So I have this string:


I just want to extract the directory address meaning I only want the bit after the ":" character and get:



I need a generic command so the cut command wont work as the $var variable doesn't have a fixed length.


Using sed:

$ var=server@
$ echo $var | sed 's/.*://'