Unix Programming - A quesiton about grep....

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2007 > A quesiton about grep....





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author A quesiton about grep....
SpreadTooThin

2007-03-29, 1:24 pm

I'm grepping through my C++ code for a delete that uses []

How (in tcsh on MAC OS X) do I grep for that?

grep [] *.cpp *.h

doesn't work...

grep "[]" *.cpp *.h

doesn't work either....

TIA

Martin Vuille

2007-03-29, 1:24 pm

"SpreadTooThin" <bjobrien62@gmail.com> wrote in
news:1175188233.193316.265200@n76g2000hsh.googlegroups.com:

> I'm grepping through my C++ code for a delete that uses []
>
> How (in tcsh on MAC OS X) do I grep for that?
>
> grep [] *.cpp *.h
>
> doesn't work...
>
> grep "[]" *.cpp *.h


Square brackets have special meaning in regular expressions.

Try

grep "\[\]" *.cpp *.h

MV

--
I do not want replies; please follow-up to the group.
Stephane CHAZELAS

2007-03-30, 7:17 am

2007-03-29, 10:10(-07), SpreadTooThin:
> I'm grepping through my C++ code for a delete that uses []
>
> How (in tcsh on MAC OS X) do I grep for that?
>
> grep [] *.cpp *.h
>
> doesn't work...
>
> grep "[]" *.cpp *.h
>
> doesn't work either....

[...]

grep -F '[]' *.cpp *.h

sometimes refered to as fgrep.

--
Stéphane
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com