From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ns1.sunset.net ([205.161.255.5] helo=onyx.sunset.net) by speech.braille.uwo.ca with esmtp (Exim 3.36 #1 (Debian)) id 1DJ480-0007mU-00 for ; Wed, 06 Apr 2005 02:35:04 -0400 Received: from sunset.net (208-53-84-216.chico.ca.digitalpath.net [208.53.84.216]) by onyx.sunset.net (8.12.10/8.12.10) with ESMTP id j366VYWi029741 for ; Tue, 5 Apr 2005 23:31:34 -0700 Received: (from rreid@localhost) by sunset.net (8.13.3/8.12.8/Submit) id j366ZdMl023472 for speakup@braille.uwo.ca; Tue, 5 Apr 2005 23:35:39 -0700 Date: Tue, 5 Apr 2005 23:35:39 -0700 From: "Ralph W. Reid" To: "Speakup is a screen review system for Linux." Message-ID: <20050406063539.GA23425@sunset.net> References: <000801c5393a$d6684050$4e31e444@nedelko83f1172> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000801c5393a$d6684050$4e31e444@nedelko83f1172> User-Agent: Mutt/1.4.2.1i Subject: Re: bash regular expressions X-BeenThere: speakup@braille.uwo.ca X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Speakup is a screen review system for Linux." List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Apr 2005 06:35:05 -0000 Your search strings are not in quotes, and are therefore interpreted by the shell directly instead of by `grep`.. For this particular set of cases, either single or double quotes will work. For differences in the single and double quotes which can make a difference in other cases, see the man page for the shell you are using (most likely `bash). For the man page for `bash, enter the following command at your system prompt: man bash Note that as I said before, the `bash` man page is somewhat lengthy, but there is a lot of good stuff in there. Here is an example of one command which solves one of your problems--I leave the other problem for you to figure out as an exercise: grep -c "\." ./testfile.txt HTH, and keep on learnin' :) . On Mon, Apr 04, 2005 at 10:22:11AM -0700, Ned wrote: > Hi all, > > I wrote a bash script and all but the two commands below were marked wrong, so I need to correct them. Hope you don't mind pointing out my mistakes: > 1. needs to output how many lines are there with a . (period) in them. I used the escape char \ before the period, but it apparently didn't work. > > echo Output the number of lines that have a \"\.\" \(period\): > grep -c \. ./test.file > > 2. this one needs to output the number of lines containing the string '/*': > > echo Output the number of lines that have the string \"'/'\*\": > grep -c /\* ./test.file > > > Thanks a lot in advance! > Ned > _______________________________________________ > Speakup mailing list > Speakup@braille.uwo.ca > http://speech.braille.uwo.ca/mailman/listinfo/speakup -- Ralph. N6BNO. Wisdom comes from central processing, not from I/O. rreid@sunset.net http://personalweb.sunset.net/~rreid ...passing through The City of Internet at the speed of light! CIRCLE AREA = _pi * r ^ 2