mirror of
https://github.com/onceupon/Bash-Oneliner
synced 2024-11-22 12:43:39 +00:00
Use equivalent regex with PCRE
Use the equivalent regex with PCRE. `[0-9]*` (and `\d*`) will output each integer, e.g.: ```bash echo 17 | grep -o '[0-9]*' ``` Whereas `\d` will split it into digits, e.g.: ```bash echo 17 | grep -oP '\d' ``` Signed-off-by: Linus G Thiel <linus@yesbabyyes.se>
This commit is contained in:
parent
c2b96736bd
commit
a97dcf2a3b
1 changed files with 1 additions and 1 deletions
|
@ -280,7 +280,7 @@ grep -c "^$"
|
|||
```bash
|
||||
grep -o '[0-9]*'
|
||||
#or
|
||||
grep -oP '\d'
|
||||
grep -oP '\d*'
|
||||
```
|
||||
##### Grep integer with certain number of digits (e.g. 3)
|
||||
```bash
|
||||
|
|
Loading…
Reference in a new issue