Jump to content

Recommended Posts

Posted (edited)

I have both grep and qgrep on my win-7 system (and qgrep on my win-98 system) and generally I can get it to do what I want.  But a current task is really p***ing me off.

I want to extract from my router's log files all lines that contain "SRC=18."

I don't want lines that contain "SRC=186.43.what-ever".  Just the lines where the first octet is 18.  not 185 or 189, etc.

My command line is [qgrep -e "SRC=18." *.log > out.txt]

But my output always includes 18n. and 18.  It's as if the "." is being completely ignored in the search string.  It doesn't matter if I put the search string in quotes or not.

Any ideas?

Edit:  see also https://stackoverflow.com/questions/10346816/using-grep-to-search-for-a-string-that-has-a-dot-in-it

:-(

Edit:  Ok, all I needed to do was put the period inside square brackets.  Don't need to put quotes around the whole thing either.

 

Edited by Nomen

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...