Chinaunix首页 | 论坛 | 博客
  • 博客访问: 340891
  • 博文数量: 89
  • 博客积分: 5152
  • 博客等级: 大校
  • 技术积分: 1155
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-25 15:12
文章分类

全部博文(89)

文章存档

2012年(1)

2011年(5)

2010年(14)

2009年(69)

我的朋友

分类:

2009-09-17 10:07:59

1.sh



#/bin/csh

#clean files
rm -rf 1 1.tmp
rm -rf IDS
rm -rf IDS.new
rm -rf ID
#find IDS
foreach file (./dlg/*.*)
        grep "IDS" $file >> 1.tmp
        #awk -F"(" '{print $2}' formatmessage | awk -F"," '{print $1}' >> 1.tmp
end
sed 's/ //g' 1.tmp | sed 's/{//g' | sed 's/}//g' >> IDS

awk -F"IDS" '{print $2}' IDS >> IDS.new
set i = 0
set l = `awk 'END{print NR}' IDS.new` #

while ( $i <= $l )
        set line=`awk "{ if (NR == $i) print}" IDS.new`
        echo $line | grep "," > /dev/null
        if ( $status == 0 ) then;
                echo "IDS"$line | awk -F"," '{print $1}' >> ID.tmp
                @ i++
                continue
        endif
        echo $line | grep ")" > /dev/null
        if ( $status == 0 ) then;
                echo "IDS"$line | awk -F")" '{print $1}' >> ID.tmp
                @ i++
                continue
        endif
@ i++
end

#delete repeat line
sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P' ID.tmp >> ID
rm -rf 1 1.tmp
rm -rf IDS
rm -rf IDS.new
rm -rf ID.tmp

2


cmp.sh


#!/bin/csh
rm -rf ID.del
./1.sh
./2.sh

set i = 0
set l = `awk 'END{print NR}' ID` #
while ( $i <= $l )
        set line=`awk "{ if (NR == $i) print}" ID`
        grep -w "$line" ID.now
        if ( $status == 0 ) then;
                #echo "IDS"$line | awk -F"," '{print $1}' >> ID.tmp
                @ i++
                continue
        endif
        echo $line >> ID.del
@ i++
end

阅读(631) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~