perl case sensitivity
Hi Guys,
When use this liner code, anyway to print "TeSt" in case insentive? ie. it should print all "test, Test, TEST etc..." Code: perl -s -ne '($user,$ou) = /.*uid=(.*?), ou=(.*?),.*/ if /^dn/; print "$user\n" if /^stat: 2/ && $ou eq "test";' infile Thanks |
please read perldoc perlre (from now on). There is a modifier to do case insensitivity in Perl's regex.
|
Instead of testing for string equality ($string eq 'test'), you should use a regular expression with the i flag.
Code:
telemachus ~ $ cat file |
All times are GMT -5. The time now is 11:14 PM. |