bash regular expressions

Ned ngranic at cox.net
Mon Apr 4 13:22:11 EDT 2005


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


More information about the Speakup mailing list