[mrtg] MRTG Script error
    Luis Carlos Solano 
    lsolano at racsa.co.cr
       
    Tue Apr 22 16:26:03 CEST 2008
    
    
  
Alex van den Bogaerdt wrote:
> Remark about your script:  in almost all cases, you need not combine
> 'grep' and 'awk' and 'sed'.
>
> Some examples:
>
> wrong: grep 'x' | awk '{print $1}' 
> good:  awk '/x/ {print $1}'
>
> wrong: grep 'x' | sed 's/x/y/g'
> good:  sed -n '/x/s/x/y/gp'
>
> wrong: grep 'x' | awk '{print $1}' | sed 's/x/y/g'
> good:  awk '/x/{gsub("x","y",$1);print $1}'
>   
Excellent advice. I've never been so good at sed/awk... I'll take some 
notes here...
Thanks.
    
    
More information about the mrtg
mailing list