wildcard inside regular expression for grep

Hi,

I'm on a Linux machine with a bash shell. I have some apache logs from where I want to extract the lines that match this pattern :

"GET /dir1/dir2/dir3/bt_sx.gif HTTP/1.1"

but where "/dir1/dir2/dir3/bt_sx" may vary , so I would like to grep something like

cat apache.log | grep "\"GET *.gif\""

which obviously doesn't work.SO I want the lines that contain "GET, space, whatever followed by .gif" ofcourse with these 2 double quotes. In other words I want to use a * wildcard in a regular expression that contains spaces also for a grep pattern. I want to use grep because It think it's faster. But eventually I can use anything else, sed, awk.. etc.

egrep '"GET .*\.gif' apache.log
1 Like

Yes, it worked, it was exactly what i needed. .* rules :smiley: