3 ms·
haven't read/processed the article fully, some nitpicks: * `\b([01]?[0-9]|2[0-3]):([0-5]\d)\b` you are using both [0-9] and \d, is that intentional? * `cat te
by asicsp 9y ago
haven't read/processed the article fully, some nitpicks:
* `\b([01]?[0-9]|2[0-3]):([0-5]\d)\b` you are using both [0-9] and \d, is that intentional?
* `cat test.txt | grep -E "^[0-9]+$"` UUoC and double quotes subjected to shell interpretation, should be `grep -E '^[0-9]+$' test.txt` or `grep -xE '[0-9]+' test.txt`
* `(?i)` won't work with `grep -E` (or at least not for me on GNU grep). features of BRE/ERE and PCRE like regex are very different - see https://unix.stackexchange.com/questions/119905/why-does-my-regular-expression-work-in-x-but-not-in-y https://unix.stackexchange.com/questions/119905/why-does-my-...
* avoid parsing ls - https://unix.stackexchange.com/questions/128985/why-not-parse-ls https://unix.stackexchange.com/questions/128985/why-not-pars... , use glob/find
* `.<star>?` again, this regex feature is not available with BRE/ERE, your example just happens to work. you can check it with `echo 'abc foo 123 bar 123' | perl -pe 's/foo.<star>?123//'` and `echo 'abc foo 123 bar 123' | sed -E 's/foo.<star>?123//'` (using <star> to avoid formatting issues)
- quotable_cow 9y agoThanks, that's all very useful feedback.
- asicsp 9y agofor the ls parsing example, you can do shopt -s nocaseglob ls ~/Downloads/*.{png,jpg,jpeg,gif,webp} ---- for command line tools (grep/sed/awk/sort/etc), you can refer my ongoing project (https://github.com/learnbyexample/Command-line-text-processing https://github.com/learnbyexample/Command-line-text-processi...) as resource :)
- spoxaka 9y agoI just have to ask. Doesn't the above comment kind of defeats the article premise?