Newb question about getting a word from a text file

Hi everyone.

I am new to shell scripting and have been looking at quite a few web pages to try and figure this out, but to no avail.

What I am trying to do is get a value from a text file that contains a paragraph of information.. Something similar too:

Welcome to random script
You are using the task XXXXXXX
The value for this task is 2.302E-4
I hope this helps

So that is basically what is in the file. Now, what I am trying to do is get the 2.302E-4 value and then use it as a variable in my script.

So far all I can find is how to output an entire line from the file.

Is there a simple way to get this value? I was thinking that their might be an array with lines and words? line[2] word[6] or something of that manner?

Any help/assistance/tips would be greatly appreciated.

I assume that the value is unknown, but other content on the line is and you could use grep to print the line from the file. I also assume that there is only one instance of that line in the file. If both are true assumptions, then this will work in either Kshell or bash:

a=( $(grep "The value.* is" data-filename) )

The array a can then be referenced like ${a[6]}

If there are more than one matching lines, you'll have to do a bit more work than this.