1251 |
other greps. |
other greps. |
1252 |
|
|
1253 |
@item |
@item |
1254 |
Why are my expressions whith the vertical bar fail? |
Why is this back-reference failing? |
1255 |
|
|
1256 |
@example |
@example |
1257 |
/bin/echo "ba" | egrep '(a)\1|(b)\1' |
echo 'ba' | egrep '(a)\1|b\1' |
1258 |
@end example |
@end example |
1259 |
|
|
1260 |
The first alternate branch fails then the first group was not in the match |
This gives no output, because the first alternate @samp{(a)\1} does not match, |
1261 |
this will make the second alternate branch fails. For example, "aaba" will |
as there is no @samp{aa} in the input, so the @samp{\1} in the second alternate |
1262 |
match, the first group participate in the match and can be reuse in the |
has nothing to refer back to, meaning it will never match anything. (The |
1263 |
second branch. |
second alternate in this example can only match if the first alternate has |
1264 |
|
matched -- making the second one superfluous.) |
1265 |
|
|
1266 |
@item |
@item |
1267 |
What do @command{grep, fgrep, egrep} stand for ? |
What do @command{grep, fgrep, egrep} stand for? |
1268 |
|
|
1269 |
grep comes from the way line editing was done on Unix. For example, |
The name @command{grep} comes from the way line editing was done on Unix. For |
1270 |
@command{ed} uses this syntax to print a list of matching lines on the screen. |
example, @command{ed} uses the following syntax to print a list of matching |
1271 |
|
lines on the screen: |
1272 |
|
|
1273 |
@example |
@example |
1274 |
global/regular expression/print |
global/regular expression/print |