Skip to Content
Minimal Perl
book

Minimal Perl

by Tim Maher
October 2006
Beginner
504 pages
12h 58m
English
Manning Publications
Content preview from Minimal Perl

Chapter 3. Perl as a (better) grep command

3.1

A brief history of grep

53

3.2

Shortcomings of grep

54

3.3

Working with the matching operator

60

3.4

Understanding Perl’s regex notation

63

3.5

Perl as a better fgrep

64

3.6

Displaying the match only, using $&

64

3.7

Displaying unmatched records (like grep -v)

65

3.8

Displaying filenames only (like grep -l)

67

3.9

Using matching modifiers

68

3.10

Perl as a better egrep

70

3.11

Matching in context

75

3.12

Spanning lines with regexes

77

3.13

Additional examples

81

3.14

Summary

86

This chapter shows you how to write one-line Perl commands and small Perl scripts that surpass the limitations of the UNIX grep command. We’ll start by reviewing grep’s history, strengths, and weaknesses, and Perl’s superior features, and then we’ll show how Perl programs ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Perl

Beginning Perl

Curtis Ovid Poe
Think Perl 6

Think Perl 6

Laurent Rosenfeld, Allen B. Downey
Perl by Example

Perl by Example

Ellie Quigley
Learning Perl 6

Learning Perl 6

brian d foy

Publisher Resources

ISBN: 9781932394504Publisher SupportOtherPublisher WebsiteSupplemental ContentPurchase Link