Thanks bro, it definitely works. Now, as you pointed out, why the \ is not enough, we'll leave that for some later time. Ned ----- Original Message ----- From: "Lorenzo Taylor" <lorenzo@xxxxxxxxxxxxxxxxxxxx> To: "Speakup is a screen review system for Linux." <speakup at braille.uwo.ca> 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! <smile> > > # 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. <smile> > > 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 at braille.uwo.ca > http://speech.braille.uwo.ca/mailman/listinfo/speakup