Say I run the command SayStuff
$ SayStuff
and the output is
Watermelons and cucumbers
Now. Say I want to extract the substring cucumbers
from the output and pipe it into something.
The way I would go about this programmatically would be to split the output into an array by the delimiter Space and reference it by ArrayName[2]
. I am fairly new to shell scripts and have only succeeded in digging up semi-cryptic cut
examples, none of which made sense.
Any ideas?