If I have a file with for example the line:
hai hello test hey hi
I then want to search for the lines with test in it, and return the two surrounding strings hello and hey.
I can get the lines in which the search word is found using:
grep "test" $file"
But I can't figure out how to only get the two surrounding strings and do further things with the strings
oat the end ofhello, the space betweenhelloandtest, or even the empty string are strings too,