Re: Log File Reviewing

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



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? 

I never remember the awk syntax because if it is really that simple I'd 
use grep with it's implied print.  But it's almost never really that 
simple and you end up needing things that are difficult in awk but easy 
in perl.  Perl can use the posix names for character classes too if you 
like to type and how can you forget the 'if (expresssion) {action}; 
syntax?  Also you could have omitted the $_ argument to print, since it 
is assumed if you are looking for simplicity.

-- 
   Les Mikesell
    lesmikesell@xxxxxxxxx

_______________________________________________
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