파일내용중에 원하는 문자열 존재여부
글쓴이 : null (2003년 08월 22일 오후 03:37) 읽은수: 3,387 [ 쉘 # 트랙백(0) ]
#!/bin/sh
# usage : grep_in_file [find string]
# 현재의 디렉토리의 파일들의 내용중에 [fund string] 가 있나 없나를 찾아줌


# in file search
finding()
{

for filename in `ls`
do
if [ -f "$filename" ]
then
result=`cat $filename | grep $1 | wc -l`
if [ $result > 0 ]
then
echo "$filename $result [ OK ] ";
fi
fi
done
return 0
}

if [ $1 ]
then
finding "$1"
else
echo "usage : grep_in_file [find string]"
fi
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2004/06/03 15:12 2004/06/03 15:12
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/197

Trackback URL : http://tcbs17.cafe24.com/tc/trackback/197

« Previous : 1 : ... 82 : 83 : 84 : 85 : 86 : 87 : 88 : 89 : 90 : ... 213 : Next »

블로그 이미지

- 홍반장

Archives

Recent Comments

  1. 1 pHqghUme 01/05
  2. 1 pHqghUme 01/05
  3. 1 pHqghUme 01/05
  4. 1 pHqghUme 01/05
  5. 1 pHqghUme 01/05

Calendar

«   2025/02   »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28  
Statistics Graph

Site Stats

Total hits:
268421
Today:
429
Yesterday:
425