Friday, March 2, 2007

[Perl Learning]: A wonderful book for perl one-liner

""" /START REGEX/ .. /STOP REGEX/ and print ; Prints all records between the first containing "START REGEX" and the first containing "STOP REGEX" (which could be the same record), and then repeats that process, looking for the next record containing "START REGEX", etc. /START REGEX/ ... /STOP REGEX/ and print ; Same as the two-dot form, except the first evaluation of STOP REGEX doesn't occur until after the record that yielded True for START REGEX has already been processed, thereby preventing both patterns from mathing the same record. """ for example: $ perl -w -nle '/Oct 19/ ... /Oct 20/ and print ' Above texts comes from Book <>, that is a really good book for me. It focuses on use perl to replace other legacy Unix command like grep, sed, awk etc. It describes perl one-liner in details, that is just the way which I want to use perl in. Strongly recommended! ;)

No comments: