I have an assignment to specify a linux command in a terminal that finds all the .c files on the system and the file name contains "lab" at the start (in all combinations of case sensitivity), followed by any number within 1-299 range ,followed by the character #, % or &. Example : lAb72# For the first part,I know that the command grep -i ignores the case sensitivity.
使用正则表达式: find / -regex "[LlAaBb][1-2][0-9][0-9][#%&]"
ls lAb*.c # will list all c file with starting lAb in same directory
find / -iname "lab[0-9]*[%&#]*.c" -print # this will list in entire file system
This should work for you:
find . | egrep "[lL][aA][bB][1-2][0-9][0-9][%&#]\\.c$"
Start from the root or /
directory, or change the above to find /
instead of find .
Hope this helps
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.