intercepts the log information between 16/Aug/2010:14:31:30 to 17/Aug/2010:10:12:07 in the access.log and outputs it to Log.txt, my idea, use sed to print 16/Aug/2010: 14:31:30 and 17/Aug/2010:10:12:07 logs and >
#!/Bin/bash
n1=`grep -n '16\\/Aug\\/2010:14:31:30' access.log|
Head -1|
Cut -d ':' -f1`
n2=`grep -n '17\\/Aug\\/2010:10:12:07' access.log|
Tail -1|
Cut -d ':' -f 1`
sed -n "${n1},${n2}p" access.log >log.txt
Additional sed The easier way
sed -n '/16\\/Aug\\/2010:14:31:30/, /17\\/Aug\\/2010:10:12:07/'p >log .txt
But this command is correct, but when the access.log has a large number of concurrent access logs at the same time, this is not accurate. The most complete one is still the first one.
We have been doing a task in the usual way until we know there is a better way to handle it. As a fo
Currently, a very serious Bash vulnerability has been exposed on the Internet. It
1 Start vSphere Client2 Start Virtual Machine [Right-click on VM, select Power —>Open] and
1. Start/stop/restart of VNC #service vncserver start/stop/restart Close the specific vncserver comm
Linux uses ipvsadm to achieve web load balancing
How to add Nginx to system services
Linux adsl dialing and sharing Internet
Linux shutdown command shutdown
Practical tips: What to do when the Linux system "crash"
Linux cron and crontab use detailed explanation
Apache rewrite configuration item explanation
Software-only dual-system hot standby solution in-depth analysis
Openssl application programming
Microsoft gives up WP's new YouTube app
Cancel the smart arrangement method of Windows 7 window
Win10 9865 activation tool download, activate key installation key
Win8 system store can not enter the prompt offline how to do
WinXP Optimized Memory Tutorial
How to open KDH file in Win7 system
How to test your computer can install Win7?