I am lost as to how to do this.. I understand basic regular expression syntax, but I can't seem to wrap my head around this one.
This is a homework assignment.. Just to clarify. I've looked everywhere but can't find an answer
The question:
Using grep -E on the above file, display the number of students who received a lab grade of 5 six times consecutively.
The file:
0673 4 5 5 5 5 5 5 5 5 4 67 80 83
0788 5 5 5 5 5 5 5 5 5 5 100 87 105
0821 5 5 5 5 5 5 5 5 5 5 93 80 88
1641 5 5 5 4 5 5 5 0 5 4 87 47 94
My answer:
So far really none... This is what I think it should be, but I'm obviously wrong
grep -E '(5\s)\{6,\}' file
I can get it to display consecutive fives with grep, not egrep (and only fives, not the spaces before or after it):
grep '5\{6,\}' file
But now I'm stuck. I know with extended regular expressions the parentheses group patterns together and the \{\} indicates how many times a character occurs before it is listed, but I can't seem to find what I need to: a 5 and a space consecutively.
Unless I'm going about this in a totally wrong direction...
let me know if that's the case
Thanks for any help
This is a homework assignment.. Just to clarify. I've looked everywhere but can't find an answer
The question:
Using grep -E on the above file, display the number of students who received a lab grade of 5 six times consecutively.
The file:
0673 4 5 5 5 5 5 5 5 5 4 67 80 83
0788 5 5 5 5 5 5 5 5 5 5 100 87 105
0821 5 5 5 5 5 5 5 5 5 5 93 80 88
1641 5 5 5 4 5 5 5 0 5 4 87 47 94
My answer:
So far really none... This is what I think it should be, but I'm obviously wrong
grep -E '(5\s)\{6,\}' file
I can get it to display consecutive fives with grep, not egrep (and only fives, not the spaces before or after it):
grep '5\{6,\}' file
But now I'm stuck. I know with extended regular expressions the parentheses group patterns together and the \{\} indicates how many times a character occurs before it is listed, but I can't seem to find what I need to: a 5 and a space consecutively.
Unless I'm going about this in a totally wrong direction...
let me know if that's the case
Thanks for any help