1/3
One night fight
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
: grep ‘Raman’ name.txt
: This command uses grep to search for lines in the file named name.txt that contain the exact string Raman. It will output any lines where this pattern is found.
: cat names.txt | grep ‘ai’; grep ‘S.n’; grep ‘.am’
: This command pipes the output of cat names.txt (which displays the content of names.txt) to three separate grep commands: grep ‘ai’ (finds lines containing ai), grep ‘S.n’ (finds lines containing S, followed by any single character, followed by n), and grep ‘.am’ (finds lines containing any single character, followed by am). Note that the semicolons allow running multiple commands sequentially, but the output of cat is only piped to the first grep.
: cat names.txt | grep ‘am$’; grep ‘.\.’ or grep ‘^M’ or grep -i ‘^e’
: This command pipes the output of cat names.txt to grep ‘am$’ (finds lines ending with am). The subsequent grep commands (grep ‘.\.’, grep ‘^M’, and grep -i ‘^e’) are run independently on the default input: find lines with any character followed by a literal dot, lines starting with M, and lines starting with e (case-insensitive), respectively.
: cat names.txt | grep ‘am\b’ or grep ‘E[ME]’ or grep ‘\bS.*[mn]’ or grep ‘B90[1-4] / [^5-7]
: This command pipes cat names.txt to grep ‘am\b’ (finds lines with am followed by a word boundary). The other grep commands run independently: grep ‘E[ME]’ (finds lines with E followed by M or E), grep ‘\bS.*[mn]’ (finds lines with a word boundary, S, any characters, and ending in m or n), and grep ‘B90[1-4] / [^5-7] (looks for "B90" followed by 1-4, then a space, slash, space, and a character not 5-7 - likely incomplete without a file).