How can I grep for a regex containing multiple ranges with at least one occurence
问题 Given the following input I'm trying to grep for lines that begin with at least thee digits: 7.3M ./user1 7.3M ./user2 770M ./user3 78M ./user4 737M ./user5 7.6M ./user6 My grep command is not working: grep ^[0-9]+[0-9]+[0-9]+M I don't understand why unfortunately. 回答1: Your regex, ^[0-9]+[0-9]+[0-9]+M , would match the start of string ( ^ ), then 1+ diigts (but it does not because + is not compatible with POSIX BRE that you are using since there is no -E nor -P options), then again 1+ digits