[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sr #106057] How do I grep for a string without a ] in it?
From: |
anonymous |
Subject: |
[sr #106057] How do I grep for a string without a ] in it? |
Date: |
Tue, 16 Oct 2007 20:13:43 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.6) Gecko/20061201 Firefox/2.0.0.6 (Ubuntu-feisty) |
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: address@hidden
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:
address@hidden:/tmp$ echo aa [ bb ] cc ] dd | grep -o "\\[.*\\]"
[ bb ] cc ]
address@hidden:/tmp$ echo aa [ bb ] cc ] dd | grep -o "\\[^]]*\\]"
address@hidden:/tmp$ echo aa [ bb ] cc ] dd | egrep -o "\\[^]]*\\]"
address@hidden:/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/
- [sr #106057] How do I grep for a string without a ] in it?,
anonymous <=