11

wildcard inside regular expression for grep

view full story
linux-howto

http://www.unix.com – 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 : Code: "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 Code: 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 (HowTos)