Shell statistics GMT0 time Zone data

Source: Internet
Author: User

and a supplier to check the data, the other side is the gmt+0 time zone, our report default Beijing time, can not be modified to GMT0,

When you export data in Excel to Excel by hour, and then to a text file, the shell turns to GMT0 for statistics:

Pre-treatment:

The time is converted to "2016-05-01-00:08:00" format data, which facilitates the comparison of timestamps.

Remove invalid "," and "$" symbols to facilitate shell text processing.

Solve the problem of the day, and then loop through the script to resolve multiple days.

# for I in ' seq  20160501 20160518 '  , do    sh tongji.sh "$i";
#!/bin/bash#test. Sh
Zone=8 Day=20160518if[  $1!=" "]  ; Then Day=$1fiTime_begin=`Date-D"+ $zone Hour $day"+"%y-%m-%d%h:%m:%s"' Time_end=`Date-D"+ $zone hour +1 day $day"+"%y-%m-%d%h:%m:%s"`Echo "Time_begin is: $time _begin, Time_end is $time _end"filename="May-1-18-cost-imp.txt"Cat  "$filename"|awk-F"\ t"   '{       if($3>="'"$time _end"'"|| $3<"'"$time _begin"'") {next; }Else{print $3,$ the    }    if( $ the!="-") { cost+= $ the    }        if( $7!="-") {Impress+= $7}}end{print impress, cost}'

Shell statistics GMT0 time Zone data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.