Usando SED :
echo "Loaded: loaded (/lib/systemd/system/<name>.service; disabled; vendor preset: enabled)" | sed -n 's/.*service; \([^;]*\).*//p'
Usando o Grep :
echo "Loaded: loaded (/lib/systemd/system/<name>.service; disabled; vendor preset: enabled)" | grep -o -P '(?<=service; ).*(?=;)'
Usando o AWK :
echo "Loaded: loaded (/lib/systemd/system/<name>.service; disabled; vendor preset: enabled)" | awk -F 'service; |;' '{print $2}'
- imprime a string entre
service;
e;