tags:

views:

65

answers:

4

I'm trying to make a filter that capture all the .exe file lines. For example, from this:

[05/Apr/2010:11:00:01 -0300] /~mauro/Lista_conceitos_BD_2004.DOC 200 46080

[05/Apr/2010:11:00:54 -0300] /~lucia/articles/PROPOR96-Rino.pdf 200 153253

[05/Apr/2010:11:01:32 -0300] /~daniel_leite/RenomearTudo/setup.exe 200 1692017

[05/Apr/2010:11:02:12 -0300] /~grv/tutrv/fig23.jpg 200 22821

[05/Apr/2010:11:04:11 -0300] /~lucia/TechRep/NILCTR981-RMartinse

I want to get this:

[05/Apr/2010:11:01:32 -0300] /~daniel_leite/RenomearTudo/setup.exe 200 1692017

I'm trying with grep -w '*.exe' filteredAccessLog > filteredSuccessIMGAccessLog but it is not working at all. If someone could help, I'd be thankful.

+5  A: 

grep -F .exe filteredAccessLog > filteredSuccessIMGAccessLog

houbysoft
I'd use -F (fixed strings) with that, otherwise . matches any character.
Kjetil Jorgensen
@Kjetil Jorgensen: oops, thanks.
houbysoft
+1 for `grep -F`, -1 for useless use of `cat`.
Aaron Digulla
@Aaron Digulla: fine, edited :)
houbysoft
+1 for `grep -F` :-)
Aaron Digulla
+2  A: 

That asterisk may not mean what you may think it means. In regular expressions, asterisk means 0 or more repetitions of the previous character or group.

ninjalj
+1  A: 

Just leave out the asterisk:

grep -w '.exe' filteredAccessLog > filteredSuccessIMGAccessLog
Dennis Williamson
+6  A: 

The asterisk means *, and the . means "any character". Give this a try:

grep "\.exe" filteredAccessLog > filteredSuccessIMGAccessLog
Curtis
This one really works !!Chers ...
Alucard