I would like to grep nvl and select with anything in between those two words. I thought in regex dot asterisk meant any number of characters so I tried this. Order also matters to me. Would like the nvl on the left and the select on the right. I saw grep did not care about order.
grep -i nvl .* select
@cokedude - to avoid ambiguity and provide clarity, please supply an example of the input and the expected output from that, tks
Q:does this need to span input lines ?.
Finally,please use the dialog boxes provided to separate text from code.
does the following example work ?
grep -i 'nvl.*selEct' somefile
And then try it with the E in lower-case 
grep does care about order within a single pattern. There are other constructs that do allow alternative patterns.
Your main issue is that the search pattern is a single option, so needs to be quoted. In this case, the .* is a filename expansion, giving at least . .. plus any hidden files in the current directory.
In fact, your code as shown gives me:
$ grep -i nvl .* select < Color
grep: .: Is a directory
grep: ..: Is a directory
grep: select: No such file or directory
That was exactly what I was hoping for. Does single quotes vs double quotes show different results? For some reason my command history did not save so I can not go back to look at what I did. Also noticed from trial and error these are different. Did not realize that the extra space made a difference.
grep -i 'nvl .* select'
grep -i 'nvl.*select'
Example data
junk nvl junk junk junk select junk
junk nvl junk junk select junk
junk nvl junk select junk
junk nvl select junk
junk select nvl junk
junk nvl junk
junk select
Just want the first four.
junk nvl junk junk junk select junk
junk nvl junk junk select junk
junk nvl junk select junk
junk nvl select junk
When you say dialog boxes do you mean the preformatted text option? I noticed my mistake right after I posted and added the preformatted text option. I am not sure how to look at the edit history so not sure about the exact timing.
Does the big E matter when we used the -i option ? Didn’t even notice that. Does single quotes vs double quotes show different results? Did not realize that the extra space made a difference in the quotes.
The -i means "ignore case", so E is like e
Both single quotes and double quotes protect, i.e. prevent the shell from doing substitutions on special characters. The single quotes do stronger protection; the double quotes would still allow the shell to do substitution of $ expressions and handling of \ escape.
The shell just removes the enclosing quotes and hands the protected string as an argument to the grep command.
In
grep -i 'nvl .* select' somefile
there must be one space after the nvl and one space before theselect, and any characters between the two spaces, so it matches
junk nvl select junk
(zero characters between the two spaces)
but not
junk nvl select junk
(only one space)
My bad – I mis-remembered the man page. I was thinking of the -o option, which shows you just the part of the line that matched. That can be useful.
$ echo 'junk nvl junk junk junk select junk' | grep 'nvl.*select'
junk nvl junk junk junk select junk
$ echo 'junk nvl junk junk junk select junk' | grep -o 'nvl.*select'
nvl junk junk junk select
$
The matched text is also colored if it is being written to the terminal (but does not show in the above), unless the option --color=never is given.
Wasn't your previous post correct??
I looked for criticism
and only found "single option" -> "single argument".
I suggested the capital E was a problem, and you rightly said you used the -i option.
@MadeInGermany also corrected me.
Having mentioned the -o option anyway, I thought it might be interesting to illustrate it.
Quoting command line arguments is one of the trickiest parts of Bash, and takes about six pages in the Bash Manual. I don't think I would be able to improve on it here.
Section 5 of Quoting shows more examples, and deeper explanations. For Sections 5.2 and 5.3, use the “Next” button at bottom right of each section.