In: Computer Science
2.
find . -iregex '.*\.\(py\|cpp\|txt\)$' -ls
the iregex command is used for regular expression matching ignoring the case and ls is used to display the details of the files. The regular expression for a file with some extension say .a would be " *.a ".
Please make sure that the spaces are as written in the answer when the command is executed.
3.
grep -r '* * *' /Folder1
the -r flag is used to search recursively in the directory (search the current directory and all sub directories) " * * * " is the regular expression for text that has 2 or more spaces.
4.
grep -r '*<<*<<*' /Folder2
the -r flag is used to search recursively in the directory (search the current directory and all sub directories) and " *<<*<<* " is the regular expression for text that has 2 or more << symbols.
5.
grep -r '(*(*)*)' /Folder2
the -r flag is used to search recursively in the directory (search the current directory and all sub directories) and "(*(*)*)" is the regular expression for text that has parenthesis inside parenthesis.
6.
grep -r '*[0-9]*[0-9]*' /Folder1/ /Folder2/ /Folder3/
The multiple folders to search in are specified this way and all other stuff is same as above.
7.
grep -r '(^{*)|(*}$)' /Folder2
The regular expression for this problem consists of ^ and $ which are the start and end symbols respectively. Rest is same as above.
9.
find / -iregex '*[0-9]*[0-9]*\.*' /Folder1/ /Folder2/ /Folder3/
The explanations are same as part 2. the regular expression is for two digits and I have added a \.* at the end of the regular expression so that the two numbers are in the file name and not in the extension.
10.
find / -iregex '*\(1*[2-9]*\|21\)*\.*' /Folder1/ /Folder2/ /Folder3/
The ecplanation is same as part 2 and part 9.