Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9054011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:34:24+00:00 2026-06-16T13:34:24+00:00

I have a shell script which parses the aws cloudfront log. awk ‘{print $1,$2,$4,$5,$8,$9,(substr($11,1,7)),$12

  • 0

I have a shell script which parses the aws cloudfront log.

awk '{print $1","$2","$4","$5","$8","$9","(substr($11,1,7))","$12 }' access_log | grep cid= | sed -e 's/\/data//g;s/\/videos//g;s/\/images//g;s/\/hls//g;s/\/rss//g;s/\/xml//g;s/cid=//g' > stats.txt

I am trying to combine fields $1 and $2 so the date time stamp resembles this format:
Date_time
0000-00-00 00:00:00

It is currently in two fields date, time
2012-12-23 20:59:47

Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:34:25+00:00Added an answer on June 16, 2026 at 1:34 pm

    The awk portion of your script is adding a comma between the date and time portions of what you want to be formatted as datetime. This is causing “YYYY-MM-DD HH:MM:SS” to appear as “YYYY-MM-DD,HH:MM:SS”.

    To get the result you’re after change your script to:

    awk '{print $1" "$2","$4","$5","$8","$9","(substr($11,1,7))","$12 }' access_log | grep cid= | sed -e 's/\/data//g;s/\/videos//g;s/\/images//g;s/\/hls//g;s/\/rss//g;s/\/xml//g;s/cid=//g' > stats.txt
    

    This should insert into the datetime field correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a shell script which outputs all of the .js and .html files
Hi I have a shell script which should run based on the return of
I have a shell script in which I have to execute two queries (on
I have a unix shell script which test ftp ports of multiple hosts listed
I have a shell script, which is run under a opensuse linux, that starts
I am writing a shell script in which I have to find the last
I have an Stand alone Application which runs Shell Script(with parameters)in Ubuntu. ProcessBuilder pb1
I have shell scripting knowledge. I have written a small shell script which will
I have a shell script which has a for loop that prints the value
I have a shell script which executes a various of commands like killing processes,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.