Extracting words and lines based on keywords

Hello!

I'm trying to process a text file and am stuck at 2 extractions. Hoping someone can help me here:

  1. Given a line in a text file and given a keyword, how can I extract the word preceeding the keyword using a shell command/script?

For example: Given a keyword "world" in the line:
"This really beautiful world goes round and round".

How can I extract the word "beautiful"? it can occur either as 2 separate terms as above "Beautiful World" or a conjoined word as "Beautiful-world". I need to extract Beautiful in either of the cases.
[I tried to get the position of the word, "World" and tried to extract the word before that. But it did gave me the entire piece of string from the beginning. However, I only need to extract the word "Beautiful" ]

  1. Given a keyword, say, "design", how can I extract the first paragraph under it?
    For example, in the text file, I have the below:
    Design:
    "This is the design for the experiment to be conducted in July. The requirements have already been signed off by the business. Prior to starting the design phase, ensure that the current design document is available for all departments."

para 2

para 3

I need to extract only the paragraph immediately below design. Is there a way I can do this using Shell commands/script?

Thanks so much in advance.

Regards,
seemad

AWK approach based on some assumptions

To print word before world:

awk '
        /world/ {
                n = match ( $0, /[^ ]*[ -]*world/ )
                s = substr ( $0, n, RLENGTH - 5 )
                sub ( /[ -]/, X, s )
                print s
        }
' file

To print paragraph after design:

awk '
        /design/ {
                f = 1
                next
        }
        f && NF {
                print $0
                exit
}'  file

Great! Thanks this works. Although, for the second one, I realise it hits the Table of Contents first which I don't want to extract from.

Guess I'll have to remove the table of contents from the actual text file.

Thanks again!