Timeline for How to make grep ignore lines without trailing newline character
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 13, 2018 at 18:49 | comment | added | ilkkachu | @dshin, allright, just goes to show that Perl's regex processing is pretty well optimized | |
| Jun 13, 2018 at 18:44 | comment | added | dshin | Hm, your original actually is clocking in slightly faster for me, but they are very close. | |
| Jun 13, 2018 at 18:42 | comment | added | ilkkachu | @dshin, also, since you're aiming for speed, you could try if replacing the second regex with ... && substr($_, -1, 1) eq "\n"' would be faster. | |
| Jun 13, 2018 at 18:42 | vote | accept | dshin | ||
| Jun 13, 2018 at 18:39 | comment | added | ilkkachu | @dshin, Perl regexes are pretty much an extension of extended regexes like what grep -E uses, so this|that works out of the box. (see this question and Perl's docs for details) | |
| Jun 13, 2018 at 18:35 | comment | added | dshin | Thanks, I like the perl solution. It appears to be within a factor of 2 of the speed of grep, which is faster than sed/python/gawk solutions. Is there a simple way to extend it to do the equivalent of egrep "pattern1|pattern2|pattern3"? | |
| Jun 13, 2018 at 18:24 | history | edited | ilkkachu | CC BY-SA 4.0 | added 44 characters in body |
| Jun 13, 2018 at 18:19 | history | answered | ilkkachu | CC BY-SA 4.0 |