I have a string, for example
"Icecream123 AirplaneBCD CompanyTL1 ComputerYU1"
Let's say I know that my string will contain for sure the substring IceCream but I don't know what follows it.
It might be 123 as in my example or it might be something different.
While I can use grep to detect if "Icecream" substring exists in my string with the following command
echo $string | grep -oF 'Icecream';
Which will print
I want with a command to get it to print the whole substring, which in my example is
Of course what follows Icecream is random and not known beforehand so I can't just do
$SUBSTRING=$(echo $string | grep -oF 'Icecream') $SUBSTRINGTRAIL=123 echo $SUBSTRING$SUBSTRINGTRAIL