| Hack: | Global Search and Replace with Perl | |
| Subject: | (\s+)? versus (\s)* | |
| Date: | 2003-03-19 16:44:23 | |
| From: | anonymous2 | |
|
I have no idea what the difference would be! but the second ane seems less complicated and shorter |
||
Showing messages 1 through 1 of 1.
-
(\s+)? versus (\s)*
2003-12-15 20:51:04 anonymous2 [View]
| Showing messages 1 through 1 of 1. |



perl -pi -e 's/^(\s+)?(telnet|shell|login|exec)/# $2/' /etc/inetd.conf
will remove any leading whitespace before "telnet" or "shell" or ...
whereas
perl -pi -e 's/^(\s)*(telnet|shell|login|exec)/# $2/' /etc/inetd.conf
Would presumably replace the line with the second whitespace charecter, if there was one...