For 1, I can get 101 to 191 to print. How do I include 203 and up as well so that it includes everything from 10 up? For 2, I can get the first set of names starting with an L to print but not the ones in the and 230. Please don't suggest I use something else like awk or sed, I want to know how to do it the way I am currently trying to do it. How can I expand the ranges I am searching in order to include more. Thanks.
Asked
Active
Viewed 43 times
2 Answers
0
Try using the * to grep for repeated Numbers like: grep "per[0-9]*:L" idfile.txt
This is a more detailed answer :) Regex - Matching arbitrary amount of numbers

CarlRosell
- 56
- 4
0
For 1) since it has to be 10 or more, it needs 2 or more digits, so just use this:
grep 'per[0-9]\{2,\}'
For 2), just do
grep 'per[0-9]*:L'
and, of course, you can combine them with
grep 'per[0-9]\{2,\}:L'

Marcin Zukowski
- 4,281
- 1
- 19
- 28