How would one match on a range of system names that are prefixed by letters?
Given: sfc30700 through sfc30900
Want all systems listed in file from sfc30750 to sfc30850 for example, and the sequence not fully populated.
I did attempt to use egrep like so, however it returns an error.
cat mahinelist.txt | egrep ':[[:sfc:]]\{30750,30850\}:'
egrep: Invalid character class name
This prints out all lines containing " sfc " directly followed by a number between " 30750 " and " 30850 ".
$ cat file
sfcdd30784
sfc30689
word sfc30750 word
sfc30753
sfc30756
sfc30900
sfc30901
daw30900
$ awk '{ n=match($0,"sfc"); m=substr($0,n+3,5)*1;
if(m>=30750 && m<=30850){ print } }' file
word sfc30750 word
sfc30753
sfc30756
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.