|
发表于 2008-10-20 17:48:16
|
显示全部楼层
#!/bin/bash
BLOCK=0
while read LINE
do
if [ "$LINE" = '[BEGIN]' ]; then
BLOCK=1
NEW_FILE=`tempfile -d . -s .txt`
NEW_FILE=${NEW_FILE#./}
echo $LINE
echo $NEW_FILE
elif [ "$LINE" = '[END]' ]; then
BLOCK=0
echo $LINE
elif [ "$BLOCK" = "1" ]; then
echo $LINE>>$NEW_FILE
else
echo $LINE
fi
done |
|