?

Log in

My plan was to use grep to search around the code base. But it… - efil4ajnin
August 25th, 2010
10:45 am

[Link]

Previous Entry Share Next Entry
My plan was to use grep to search around the code base. But it looks like grep doesn't support the regular expression features I need/want. So I'll be learning a little perl, just enough to do the kind of string searches I want.

Here's the conversation I had with the system:

$ grep -c make gnuchess-5.06.tar

175

$ grep -c ma?ke gnuchess-5.06.tar

0

$ grep -c m(a|)ke gnuchess-5.06.tar

bash: syntax error near unexpected token `('

In English: the system found 175 instances of the string 'make', but a couple of wildcard searches, which should have returned a value of 175 or higher, returned 0 and a syntax error. I searched through man grep to see if there were any details on what metacharacters it supports, but found nothing.

Perl is the tool I want for powerful string searches. I need to install the perl documentation package on my system. I have never installed a package before. So, I'll be learning a little something about that.

I am through the looking glass.

EDIT: I've just been told that egrep does what I want. I will try that. I'm still going to learn perl, though.

Tags:

(Leave a comment)

Powered by LiveJournal.com