Tuesday, April 30, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 883  / 1 Year ago, mon, may 29, 2023, 2:50:59

I have this following file:



$ cat numbers
a1
12
12345
123456
19816282
1@$%6


I am using grep "^[0-9]{1,6}$" numbers which is giving me the following results:



12
12345


I am also expecting 1@$%6 in the results.


More From » grep

 Answers
5

The result is actually



12
12345
123456


Your regex means "A line consisting of 1 to 6 digits and nothing else" so 1@$%6 doesn't match.


[#32694] Tuesday, May 30, 2023, 12 Months  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
moloy

Total Points: 457
Total Questions: 93
Total Answers: 119

Location: Romania
Member since Wed, Dec 29, 2021
2 Years ago
;