$ perl -e 'my $str = "xyzxyzxyz - Prod Cache Broker - 16100"; print "$str\n$1\n" if $str =~ /(\w+)/;' xyzxyzxyz - Prod Cache Broker - 16100 xyzxyzxyz