From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gscodenh01.cr.usgs.gov ([136.177.7.10]) by speech.braille.uwo.ca with esmtp (Exim 3.36 #1 (Debian)) id 1DIaxv-0008Oq-00 for ; Mon, 04 Apr 2005 19:26:43 -0400 Received: from PUNK ([130.118.172.119]) by gscodenh01.cr.usgs.gov (Lotus Domino Release 6.5.2) with SMTP id 2005040417261125-71472 ; Mon, 4 Apr 2005 17:26:11 -0600 Message-ID: <005f01c5396d$afd6de00$77ac7682@azwaterDOM.wr.usgs.gov> From: "Sean McMahon" To: "Speakup is a screen review system for Linux." References: <000801c5393a$d6684050$4e31e444@nedelko83f1172> <20050404230311.GA4731@taylor.homelinux.net> Date: Mon, 4 Apr 2005 16:26:10 -0700 MIME-Version: 1.0 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-MIMETrack: Itemize by SMTP Server on gscodenh01/SERVER/USGS/DOI(Release 6.5.2|June 01, 2004) at 04/04/2005 17:26:11, Serialize by Router on gscodenh01/SERVER/USGS/DOI(Release 6.5.2|June 01, 2004) at 04/04/2005 17:26:42, Serialize complete at 04/04/2005 17:26:42 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="iso-8859-1" Subject: Re: bash regular expressions X-BeenThere: speakup@braille.uwo.ca X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Sean McMahon , "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: Mon, 04 Apr 2005 23:26:43 -0000 I also find it's best to execute the commands by themselves before including them in some massive script. Helps the diagnosis. ----- Original Message ----- From: "Lorenzo Taylor" To: "Speakup is a screen review system for Linux." Sent: Monday, April 04, 2005 4:03 PM Subject: Re: bash regular expressions > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Ned's comments on bash regular expressions were as follows: > # 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: > > Well, I'll see what I can do. Here goes nothing! > > # 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 > > Try: > > echo Output the number of lines that have a \".\" \(period\): > grep -c [.] ./test.file > > I can't explain it, but somehow it only works that way. Escaping the period > doesn't help. It must be specified in a range by itself. > > # 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 > > Try this instead: > > echo Output the number of lines that have the string '"/*"': > grep -c [/][*] ./test.file > > Again, each character seems as though it must be enclosed in range brackets by > itself. Not exactly sure why without further digging in manpages for grep(1) and > regex(3), which is something I may do in the future if the mood hits me, but as > long as this works, I just don't feel like it right now. > > HTH, > Lorenzo > - -- > "We decided that we should evaluate the Microsoft offerings first. Once we > realised what a powerful set of tools they were, it became self-evident this was > the right way to go down." > > Microsoft: the right way to go down > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.0 (GNU/Linux) > > iD8DBQFCUcevG9IpekrhBfIRAs1uAJ9/qfMLcyIuzP19Tx8I5HlIbEC/VACeJHod > RaMPPXLUHrKsBmDFYk2f2p4= > =R6qv > -----END PGP SIGNATURE----- > > _______________________________________________ > Speakup mailing list > Speakup@braille.uwo.ca > http://speech.braille.uwo.ca/mailman/listinfo/speakup