标签:shell
#!/bin/bash for i in {1..5} do echo workspace${i} >> /opt/server.log TAIL=$(grep -n ‘^\[11‘ /data/serverlogs/workspace$i/warn/warn | awk -F: ‘{print $1}‘ | tail -1) HEAD=$(grep -n ‘^\[11‘ /data/serverlogs/workspace$i/warn/warn | awk -F: ‘{print $1}‘ | head -1) COUNT=`expr $TAIL - $HEAD` head -${TAIL} /data/serverlogs/workspace$i/warn/warn | tail -$COUNT >> /opt/server.log echo >> /opt/server.log done
本文出自 “YHT的运维笔记” 博客,请务必保留此出处http://yht1990.blog.51cto.com/9014030/1920066
标签:shell
原文地址:http://yht1990.blog.51cto.com/9014030/1920066