파일내용중에 원하는 문자열 존재여부
글쓴이 : 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 : ... 5882 : 5883 : 5884 : 5885 : 5886 : 5887 : 5888 : 5889 : 5890 : ... 6391 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/05   »
      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 29 30 31  
Statistics Graph

Site Stats

Total hits:
186395
Today:
653
Yesterday:
745