URL:
<http://savannah.gnu.org/support/?106057>
Summary: How do I grep for a string without a ] in it?
Project: grep
Submitted by: None
Submitted on: Tuesday 10/16/2007 at 20:13 UTC
Category: None
Priority: 5 - Normal
Severity: 3 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email: [EMAIL PROTECTED]
Open/Closed: Open
Discussion Lock: Any
Operating System: GNU/Linux
_______________________________________________________
Details:
I want to grep the date string from my apache logs, but some user agents have
a bracket in them. I need a way to grep for a string that doesn't have a ] in
it. These are things I have tried:
[EMAIL PROTECTED]:/tmp$ echo aa [ bb ] cc ] dd | grep -o "\\[.*\\]"
[ bb ] cc ]
[EMAIL PROTECTED]:/tmp$ echo aa [ bb ] cc ] dd | grep -o "\\[^]]*\\]"
[EMAIL PROTECTED]:/tmp$ echo aa [ bb ] cc ] dd | egrep -o "\\[^]]*\\]"
[EMAIL PROTECTED]:/tmp$ echo aa [ bb ] cc ] dd | egrep -o "\\[^\\]]*\\]"
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/support/?106057>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/