Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Regular Expression for sed & awk by Susan Lukose.

Similar presentations


Presentation on theme: "Introduction to Regular Expression for sed & awk by Susan Lukose."— Presentation transcript:

1 Introduction to Regular Expression for sed & awk by Susan Lukose

2 Regular Expression Regular Expression way to match text with patterns Regular ExpressionExample of Matched Text Example of Unmatched Text abcabcdefg cccdabcgf bcagjjfg gjkgfkk ^abcabcjjdjedgabcjjjd abc$jhsjdabc abc abcchghhsd a.bacb davb avhsjvhb ab a.*bab ajjdjkxb ba a*bbhsghgh aaaaaabmnjkk acb a.+bacb ahjhhjjbcsdfs ab a+baaaaaabbkfjdkj

3 Regular Expression {n} Match exactly n times {n,} Match at least n times {n,m} Match at least n but not more than m times regular expressionexample of matched textexample of unmatched text a?bbc abd aab

4 Regular Expression Grouping could be done with () – (ab) – gg(ab)*gg Class could be specified [] – [abc] Match any of a, b, and c. – [a-z] Match any character between a and z. (ASCII order) – [^abc] A caret ^ at the beginning indicates "not". In this case, match anything other than a, b, or c. regular expression should be specified between // Special characters like ^, $,. etc.. Could be matched by escaping with \


Download ppt "Introduction to Regular Expression for sed & awk by Susan Lukose."

Similar presentations


Ads by Google