☰
-
Php 95
-
Java 94
-
Javascript 37
-
Regex 18
-
Git 17
-
Security 16
-
Docker 07
-
Python 58
-
Machine Learning 14
-
Book Highlights
Regex Grep Any Character
Shorthand for any character [.] not the same as . grep '19.03.2022' 19/03/2022 19-03-2022 // matches both
Dot
p11 Shorthand for any character is .
#!/bin/sh
: "Shorthand for any character
Remember that metacharacters are different inside and outside a class
[-./] more precise, [.] not the same as .
"
A='19/03/2022'
B='19-03-2022'
C='1910312022'
echo $A | grep '19[-./]03[-./]2022' -o | tee result.txt
echo $B | grep '19[-./]03[-./]2022' -o | tee result.txt -a
echo $C | grep '19.03.2022' -o | tee result.txt -a

19/03/2022
19-03-2022
1910312022
➥ Questions
Last update: 60 days ago