I have the following types of file names:
One ends with .html:
l_scheduling_suite.temp.html
Another type ends with .html but has .bin in its name:
l_scheduling_suite.temp.bin.html
And a third ends with .bin:
l_scheduling_suite.temp.bin
The filename is arbitrary. It won't necessarily always have a temp before .html or .bin. I need to find all the files that comply with only the first format. I am piping to grep using the following regex to find the files, but I am not able to make it work:
"(?=(\.html)$) (?=(?!\.bin))"
How should I use grep or find to get the right list of files?
Try this:
find -type f | grep -P '^.*(?<!\.bin)\.html$'
This uses a negative lookbehind. Basically it means, get all names that end with .html, but then just make sure that .bin doesn't come before it.
You're vastly overcomplicating the problem. All you need (based on your posted corpus) is:
find . -name \*.temp.html
This will find all files that end with .temp.html. Your other examples wouldn't match because *.bin.html and *.temp.bin have no overlap with this glob pattern.
If your corpus was poorly chosen, and you're actually trying to match all files that end in .html but that don't include .bin anywhere in the name, then you can just use the find utility with a negated glob without resorting to regular expressions, pipes, extended shell globs, or other contortions. For example:
find . -name '*.html' -not -name '*.bin*'