linux find
Find if a string exists in all files under a directory:
find .|xargs grep -ri "IBM"
Find if a string exists in all files under a directory, and only print the filenames:
find .|xargs grep -ri "IBM" -l
- Regular Expressions
(1) Regular expressions are generally used to describe special text patterns, consisting of ordinary characters (e.g., a-z) and special characters (called metacharacters, such as /, *, ? etc.).
(2) Basic Metacharacter Set and Their Meanings
^: Matches only the beginning of a line. E.g.,^amatches lines starting with 'a' like abc, a2e, a12, aaa, etc.$: Matches only the end of a line. E.g.,a$matches lines ending with 'a' like bca, 12a, aaa, etc.\*: Matches zero or more occurrences of the preceding single character. E.g.,(a)*matches empty string, a, aa, aaa, etc.[]: Matches only characters within[]. It can be a single character or a