ºìÁªLinuxÃÅ»§
Linux°ïÖú

°Ù¶ÈLinux±ÊÊÔÌâ

·¢²¼Ê±¼ä:2007-11-06 10:11:14À´Ô´:ºìÁª×÷Õß:cerroreta
1. ´Óa.logÎļþÖÐÌáÈ¡°üº¬"WARNING"»ò"FATAL"£¬Í¬Ê±²»°üº¬"IGNOR"µÄÐУ¬È»ºóÌáÈ¡ÒÔ":"·Ö¸îµÄµÚ5¸ö×Ö¶Î

2. ±àдһ¸ö½Å±¾£¬Ö»Ïë¼òµ¥µÄ¼õ·¨ÔËË㣬ҪÇóÌáʾÊäÈë±äÁ¿

3. Shell½Å±¾ÔĶÁ£¨½âÊÍÏÂÃæÖ´ÐеŦÄÜ£©£¬ÇëÌô³öÏÂÃæ³ÌÐò»ò½Å±¾ÖеĴíÎ󣬲¢ËµÃ÷´íÔÚÄÄÀï¡£

#!/bin/bash

#¼à¿ØcpuserµÄpoint¶Ë¿ÚÊÇ·ñÕý³£

logname="/home/forum/log/lpointlog.wf"

flagfile="/home/forum/log/lognum.txt"

lodnum=sed -n "1,1 p"$flagfile

newnum=wc -l ${logname}

echo $newnum >$flagfile

totalnum=expr $newnum -$oldnum

tail -n $totalnum $logname |grep "POINT_THREAD WARNING"

if [$?==0]

then

mail -s "cpuser point "¶Ë¿ÚÒì³£,Çë´¦Àí!" test@aa.com
fi>

A:

1. grep -invert-match "IGNOR" a.log | grep -line-number "WARNING\|FATAL" | cut ':' -f 5 »ò

grep -E 'warning|fatal' file | grep -v ignor | awk -F ":" '{print $5}'

2. #!/bin/bash

read Arg1

read Arg2

Result=`expr $Arg1 - $Arg2`

echo $Result »ò

#!/bin/bash

declare -rx SCRIPT=${0##*/}

declare -ix NUM1

declare -ix NUM2

declare -ix NUM3

read -p "input a number" NUM1

read -p "input another number" NUM2

let "NUM3=NUM1-NUM2"

printf "the result of $NUM1 minus $NUM2 is %d\n" "$NUM3"

3. ÃüÁîÐÐÌæ»»Ó÷´ÒýºÅ£¬if [$?==0] Ó¦¸Ãд×öif [ $?=0 ]£¬ÓÃÀ´ÅжÏÉÏ´ÎÃüÁîÊÇ·ñÖ´Ðгɹ¦£»

µ¹ÊýµÚ¶þÐÐÓ¦¸ÃÊÇ>/dev/null£¬×îºófiºóÃæµÄ>È¥µô¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 2 ÌõÆÀÂÛ

  1. haolifengwang ÓÚ 2012-02-02 16:30:59·¢±í:

    Å£B£¡

  2. wwwangwei159 ÓÚ 2010-11-20 09:15:12·¢±í:

    Ë­Äܽâ´ðһϡ£