uli101 Week09

uli101 Week09 - ULI101 Week 09 Week Overview Regular...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
ULI101 Week 09
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Week Overview Regular expressions basics Literal matching .wildcard Delimiters Character classes Repetition symbols Anchoring Advanced filtering using grep and egrep Search and replace in vi sed
Background image of page 2
Regular Expressions Define set of characters using a simple expression or a pattern Used mainly for searching and/or replacing strings Used by various UNIX utilities: vi grep/egrep awk sed Regular expressions match input within a line Regular expressions are very different than shell meta-characters
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Literal Matching Contains no special characters Matches only itself (literally) Matches entire words or parts of it Examples: / disk / - will match: disk ette, disk , disk s… / my book / - will match my book , dum my book
Background image of page 4
Regular Expression Delimiters Each regular expression should be delimited This is particularly important to prevent the shell from interpreting special characters Delimiters mark beginning and end of the regular expression Depending on a situation and utility used different characters can be used as a delimiter For grep/egrep the delimiter is usually the double quote For vi the delimiter is usually the forward slash
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Special Characters Special characters and expressions can be used to build regular expressions for pattern matching Standard special characters include: ., *, [], ^, $ Depending on the utility and its version, some versions support standard regular expressions and some support extended regular expressions Extended special characters include: ?, +, {}, | Although some of them may look like shell expansion characters they usually mean something else Whenever you wish to match a special character literally it must be quoted
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/14/2011 for the course CNS 101 taught by Professor Murraysaul during the Fall '11 term at Seneca.

Page1 / 19

uli101 Week09 - ULI101 Week 09 Week Overview Regular...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online