110 likes | 250 Vues
Pattern Matching. CSCI N321 – System and Network Administration. Section Overview. Regular Expressions Matching Characters Grouping/Repetition Characters Tagging (Buffering) Character Classes. CQU 85321 System Administration Course. References. Textbook Chapter 7. Lectures 1999 #7.
E N D
Pattern Matching CSCI N321 – System and Network Administration
Section Overview • Regular Expressions • Matching Characters • Grouping/Repetition Characters • Tagging (Buffering) • Character Classes
CQU 85321 System Administration Course References Textbook • Chapter 7 Lectures • 1999 #7
Pattern Matching • Powerful tool to extract/modify file data • Regular Expressions • Special “string” used to match patterns • Special (Meta) Characters • Matching • Grouping/Repeating • Tagging (buffering) • Use with ASCII files
Programs supporting REs • Extracting information • grep • egrep • Modifying information • sed & awk • ex & vi • Filename globbing versus REs
Tagging (Buffering) • Takes the output from one RE and uses it again later • REs to reuse are in \( \) - Tagging • Buffers are referenced by \n where n is the register number $ egrep ‘([a-z])([a-z])\2\1’ /usr/share/dict/words Would return words like attach, better, and common.