scripting fun

Felipe Figueiredo philsf79 at gmail.com
Wed Jun 11 21:39:17 UTC 2008


On Friday 06 June 2008 19:51:06 Cameron Hutchison wrote:


> One more refinement I can see - grep piped into awk is redundant most of
> the time.
>
> The command pipeline:
>   grep DROP | awk '{print $4}'
> can be replaced with
>   awk '/DROP/ {print $4}'
>
> The second one:
>   grep -i slurp .../access.log | awk '{print $1}'
> is a little trickier since awk does not have a non-verbose
> case-insensitive switch, so you have to do one of these:
>   awk '/[Ss][Ll][Uu][Rr][Pp]/ {print $1}' .../access.log
>   awk '/slurp/ {print $1}' IGNORECASE=1 .../access.log
>

Now this is exactly why I'm subscribed to this list. :)
Thanks for the tip!

regards
FF




More information about the ubuntu-users mailing list