good day all
this is a noob question, but I can't seem to find the answer to this anywhere. Other functions like 'cut' or 'awk' or 'sed' are always mentioned but never using the string expression function (I think it is called)
string="hi this is a string.and.it has no purpose other than being here"
searchstring="and"
temp=${string#*$searchstring} # this means everything after "and" will be inserted into temp
echo $temp = "hi this is a string."
but say I want everything before "and" and by using the same method which I used to get the temp variable result, thus I want
echo $temp = ".it has no purpose other than being here"
I have tried
temp=${string%*$searchstring} (as I understand, # is from front and % is back)
but this returns only string's contents unaltered
Also, man pages, what is this called, this string expression function, where can I find more indepth information?