Using egrep to match patterns
Hi there,
I am hoping to get some help with this exercise; I need to make regular expressions for collections with egrep to solve it. Given are a lot of lines with numbers and spaces ig: 222 266222 266 6444 44555 577 To be a part of the collection, the sum of the numbers two places before the space and to places after have to be 8. 222 266222 266 -> 2+6=8 I have to do this for these combinations: 2 and 6, 5 and 3 So far I have this: egrep '(2. .6|6. .2|3. .5|5. .3)' But with this expression, as long as one space matches the expression it becomes part of the collection, so I can still end up with 7. .7 at another space for example. I need this expression to match for every possible space. Any ideas? Thanks in advance Sara |
probably you need to negate: use egrep to drop lines where pattern does not match
|
All times are GMT -5. The time now is 05:57 AM. |