How does linux remove all characters except the specified string in a line and display only the specified string?

  linux, question

How does linux remove all characters except the specified string in a line and display only the specified string? What command should be used, grep? awk? sed?

For example, one line in a file reads:

fasfaskjkjkwordkfjkdsjfksjxxxxxxxxfsafadsfkklabcd.fdsf342

The specified character string means that it starts with the word word and ends with the word abcd, with any 0 or more characters in the middle. how can you intercept the character string that meets this characteristic and throw away the useless characters on both sides? This is shown as follows:

wordkfjkdsjfksjxxxxxxxxfsafadsfkklabcd

grep:
 echo ...|grep -oP 'word.*abcd'
 
 sed:
 echo ... |sed -r 's/.*(word.*abcd).*/\1/g'
 
 awk:
 echo ... |awk '{print gensub(".*(word.*abcd).*","\\1","g")}'