I either get errors or nothing returned. I don't know if it's something simple or not, but any help would be appreciated. I'm not opposed to sed or awk, but my knowledge of them is basically clean slate.
Also, this is *NOT* a homework assignment. It's me trying to learn by doing and hitting a wall repeatedly. Thanks for the help!!!
Please show us a sample input file (including samples of the lines that are giving you problems with spaces) and the output you are trying to produce.
What operating system are you using. Some implementations of grep have a non-standard -o option that prints only the text matched by the search pattern; not the entire line containing the matched text.
I am still not sure why the lookbehinds didn't work. Please let me know if you have any insight into what I'm doing wrong and thank you so much for the help!
The system I use doesn't have lookbehinds, so I can't experiment and definitively say why your lookbehind attempts were failing. The \S is not standard in REs either. A standard ERE that matches a string starting with http: , containing /pic/ , ending with jpg , and containing no spaces is:
http:[^ ]*/pic/[^ ]*jpg
This same string used as a BRE produces the same results, so I would just use:
I have GNU grep and it doesn't work on it.
Most likely grep's "-E" option does not support lookarounds. The man page or the GNU page at: GNU Grep 2.21
do not mention anything about lookarounds.
The "-E" option for "Extended REs" provides the special meaning to metacharacters like "+", "|", "{" etc. unlike BREs.