Minimal Perl For UNIX and Linux People 1 ppsx

51 885 0
Minimal Perl For UNIX and Linux People 1 ppsx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... sed to Perl translator 4 .11 Summary 11 8 Directions for further study ✦ 11 4 Substitutions using 11 8 12 0 xi 5 Perl as a (better) awk command 12 1 5 .1 A brief history of AWK 12 2 5.2 Comparing basic features of awk and Perl 12 3 Pattern-matching capabilities 12 4 ✦ Special variables 12 6 Perl s variable interpolation 12 8 ✦ Other advantages of Perl over AWK 12 9 ✦ Summary of differences in basic features 12 9 5.3... number: Perl 10 0 ✦ Printing records by number: Perl 10 1 4.5 Modifying templates 10 1 4.6 Converting special characters 4.7 Editing files 10 5 10 3 Editing with commands 10 5 ✦ Editing with scripts Safeguarding in-place editing 11 1 4.8 Converting to lowercase or uppercase 10 7 11 3 Quieting spam 11 3 4.9 Substitutions with computed replacements Converting miles to kilometers 11 4 function results 11 6 4 .10 The... arguments 18 8 Defending against grep’s messes 18 9 ✦ Recursive grepping Perl as a generalized argument pre-processor 19 2 19 1 6.5 Using find | xargs vs Perl alternatives 19 2 Using Perl for reliable timestamp sorting 19 3 Dealing with multi-word filenames 19 6 6.6 find as an argument pre-processor for Perl 19 7 6.7 A Unix- like, OS-portable find command 19 8 Making the most of find 2perl friends with find 2perl 19 9 19 8... files: scan4oops 16 8 5.9 Using the AWK-to -Perl translator: a2p Tips on using a2p 17 5 17 5 5 .10 Summary 17 5 Directions for further study 17 7 6 Perl as a (better) find command 17 8 6 .1 Introducing hybrid find / perl programs 18 0 6.2 File testing capabilities of find vs Perl 18 0 Augmenting find with Perl 18 3 6.3 Finding files 18 4 Finding files by name matching pathname matching 18 7 xii 18 4 ✦ Finding files... fields 13 0 Accessing fields 13 0 ✦ Printing fields 13 2 ✦ Differences in syntax for print 13 4 ✦ Using custom field separators in Perl 13 6 5.4 Programming with Patterns and Actions 13 8 Combining pattern matching with field processing 14 2 Extracting data from tables 14 3 ✦ Accessing cell data using array indexing 14 5 5.5 Matching ranges of records 15 1 Operators for single- and multi-record ranges 15 2 ✦ Matching... Helping non -Unix 6.8 Summary 200 Directions for further study Part 2 2 01 Minimal Perl: for UNIX and Linux Shell Programmers 203 7 Built-in functions 205 7 .1 Understanding and managing evaluation context 206 Determinants and effects of evaluation context 207 Making use of evaluation context 208 7.2 Programming with functions that generate or process scalars 210 Using split 211 ✦ Using localtime 214 ✦ Using... 33 Shell and Perl techniques for writing messages to STDOUT and STDERR 36 Special variables for I/O operations 42 Special variables for formatting output 43 Standard option clusters for Perl commands and scripts 45 3.9 3 .10 3 .11 3 .12 Chapter 3 String escapes for representing control... show_user script 357 Browsing man pages: the perlman script 358 356 10 .8 Summary 360 Directions for further study 3 61 11 Subroutines and variable scoping 362 11 .1 Compartmentalizing code with subroutines Defining and using subroutines strict 368 365 ✦ 363 Understanding use 11 .2 Common problems with variables 370 Clobbering variables: The phone_home script 3 71 ✦ Masking variables: The 4letter_word script... needlessly complex and too hard to learn Minimal Perl was created to address these obstacles presented by Perl s redundancy and complexity By emphasizing Perl s grep, sed, and awk-like features, and relying 1 Before you despair, I should point out that Minimal Perl uses only 2 of these variations—which is all anybody needs! xix on concepts such as inputs, filters, and arguments, it allows Unix1 users to directly... Summary 51 Directions for further study 51 3 Perl as a (better) grep command 53 3 .1 A brief history of grep 53 3.2 Shortcomings of grep 54 Uncertain support for metacharacters 54 ✦ Lack of string escapes for control characters 56 ✦ Comparing capabilities of greppers and Perl 57 3.3 Working with the matching operator 60 The one-line Perl grepper 3.4 3.5 3.6 3.7 61 Understanding Perl s regex notation 63 Perl . Perl: for UNIX and Linux Users 1 1 Introducing Minimal Perl 3 2 Perl essentials 16 3 Perl as a (better) grep command 53 4 Perl as a (better) sed command 89 5 Perl as a (better) awk command 12 1 6 Perl. function results 11 6 4 .10 The sed to Perl translator 11 8 4 .11 Summary 11 8 Directions for further study 12 0 xii 5 Perl as a (better) awk command 12 1 5 .1 A brief history of AWK 12 2 5.2 Comparing. for UNIX and Linux Users 1 1 Introducing Minimal Perl 3 1. 1 A visit to Perlistan 3 Sometimes you need a professional guide 5 1. 2 Perl can be simple 7 1. 3 About Minimal Perl 7 What Minimal Perl isn’t

Ngày đăng: 06/08/2014, 03:20

Từ khóa liên quan

Mục lục

  • Minimal Perl

    • contents

    • foreword

    • preface

    • acknowledgments

    • about this book

      • Audience and organization

        • Part 1: Perl for UNIX and Linux users

        • Part 2: Perl for UNIX and Linux Shell programmers

        • Reference materials

        • Author’s approach

          • Reference value

          • Forewarned is forearmed

          • Entertainment value

          • Essential terminology

          • Typographical conventions

            • Constant width

            • Constant width bold

            • Italics

            • Markup for highlighting and cross-referencing

            • Special characters

            • Shell and Perl comments

            • Displays of commands or code with output

              • Shell command-with-output displays

              • Perl code-with-output displays

              • Ellipsis marks

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan