Difference between revisions of "Introduction to Linux in HPC/Text display search"
Introduction to Linux in HPC/Text display search
Jump to navigation
Jump to search
Line 63: | Line 63: | ||
|type="()"} | |type="()"} | ||
+ Klick and submit to see the answer | + Klick and submit to see the answer | ||
− | || | + | || grep -rnw '/path/to/somewhere/' -e 'pattern' |
− | || | + | || -r or -R is recursive, |
− | || | + | || -n is line number, and |
− | || | + | || -w stands for match the whole word. |
− | | | + | | -l (lower-case L) can be added to just give the file name of matching files. |
</quiz> | </quiz> | ||
{{hidden end}} | {{hidden end}} |
Revision as of 17:08, 1 October 2020
Video
Linux Introduction Slides 58 - 64 (7 pages)
Slide Layout
page 1: grep command and syntax important options: -r, -i and -I page 2: many commands to display text cat less head and tail page 3: 40 sec console has three streams stdin stdout stderr page 4: stream in computing terms similar to streaming video input/output stream in console page 5: input/output streams can be redirected redirect stdout redirect stdin pipe page 6: stream append redirection numbered streams: 0 for stdin, 1 for stdout, 2 for stderr page 7: use grep to search piped output text
Quiz
1. Which command can be used to append text to filename?
2. How do I find all files containing specific text on Linux?
HINT: use grep command
HINT: use grep command
Info: | no tips in this section |