bug-grep
[Top][All Lists]
Advanced

[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: Tony Abou-Assaleh
Subject: [sr #106057] How do I grep for a string without a ] in it?
Date: Tue, 16 Oct 2007 20:33:46 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7

Follow-up Comment #1, sr #106057 (project grep):

$ echo aa [ bb ] cc ] dd | grep -o "[ [^]]* ]"
[ bb ]

If you need to remove the square brackets:

$ echo aa [ bb ] cc ] dd | grep -o "[ [^]]* ]" | sed 's/[][]//g'
 bb 

where '[][]' means a character class containing ']' and '['.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/support/?106057>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]