TAILIEUCHUNG - Principles of Network and System Administration 2nd phần 10

Vài quản trị hệ thống làm việc một mình. Trong hầu hết trường hợp, họ là một phần của một nhóm những người cần phải giữ ngang nhau của các hành vi của hệ thống và thay đổi được thực hiện trong chính sách quản lý. Tự động hóa các vấn đề quản trị hệ thống không làm thay đổi điều này. | PERL 571 Similarly we can search for lines containing a string. Here is the grep program written in Perl local bin perl grep as a perl program Check arguments etc while print if ARGV 1 The operator search-string returns true if the search string is a substring of the default variable _. To search an arbitrary string we write . if teststring search-string Here teststring is searched for occurrences of search-string and the result is true if one is found. In Perl you can use regular expressions to search for text patterns. Note however that like all regular expression dialects Perl has its own conventions. For example the dollar sign does not mean match the end of line in Perl instead one uses the n symbol. Here is an example program which illustrates the use of regular expressions in Perl local bin perl Test regular expressions in perl NB - careful with symbols etc. Use quotes since the shell interprets these open FILE regex_test regex ARGV ARGV Looking for ARGV ARGV in file. while FILE if regex print 572 APPENDIX B. PROGRAMMING AND COMPILING This can be tested with the following patterns . . prints every line matches everything all lines except those containing only blanks . doesn t match ws white-space a-z matches any line containing lowercase Aa-z matches any line containing something which is not lowercase a-z A-Za-z matches any line containing letters of any kind 0-9 match any line containing numbers . line containing a hash symbol followed by anything . line starting with hash symbol first char n match line ending in a semi-colon Try running this program with the test data on the following file which is called regex_test in the example program. A line beginning with a hash symbol JUST UPPERCASE LETTERS just lowercase letters Letters and numbers 123456 123456 A line ending with a semi-colon Line with a comment COMMENT. Generate WWW pages auto-magically The following program scans through the password database and builds a standardized html-page for each .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.