#! /bin/bash #Scp all server tomcat access logs to /opt/shencl/logs/ on the same machine, execute this script, you can get all urls DIR_NAME="/opt/shencl/logs/" REPORT_FILENAME="/opt/shencl/url.txt" for line in `dir $DIR_NAME` do line=${DIR_NAME}${line} echo current file is $line cat $line | awk {'print "http://"substr($6,0,length($6)-1)'} >> $REPORT_FILENAME done