Re: Log File Reviewing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Tue, Jan 06, 2009, Spiro Harvey wrote:
>> Why not just start with perl which does more than sed/awk while using 
>> similar syntax (if you want)?
>
>This is why:
>
>awk '/^[[:space:]]*word/ {print}' logfile
>
>vs
>
>perl -ne 'if (/^\s*word/) { print $_; }' logfile
>
>Which syntax is likely to be easier to remember? 

It depends entirely on what you want to do.  For on-liners, sed, awk, and
grep, and pcregrep (grep using perl regular expression syntax which is
considerably more concise than [:space:] and friends) are often the best
tools.  For anything more complex, scripting languages such as python and
perl are generally more flexible and easier to use.

I used to some pretty complex shell and awk scripts before learning perl
about 20 years ago.  Perl allowed me to do most things in a single language
including fairly low-level system calls that I previously had to do with
compiled ``C'' programs.

I have switched all of my new development primarily to python which I find
far cleaner than perl, and easier to use for large projects.  Python uses
perl regular expression syntax so the transition was pretty painless.

Bill
-- 
INTERNET:   bill@xxxxxxxxxxxxx  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186

"The liberties of a people never were, nor ever will be, secure, when the
transactions of their rulers may be concealed from them." -- Patrick Henry
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux