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

  • SEARCH
  • Home
  • 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 8867669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:06:05+00:00 2026-06-14T17:06:05+00:00

I am new to bash and I have a file like this : 2012-11-22

  • 0

I am new to bash and I have a file like this :

2012-11-22 11:36:55,909 1353551815756 1353551815909 0 true myapi 10 203051 203051:ShopDb:ShopDb
2012-11-22 11:37:00,292 1353551820146 1353551820292 0 true myapi 10 201897 201897:ShopDb:ShopDb
2012-11-22 11:38:01,824 1353551881672 1353551881824 0 true myapi 10 203051 203051:ShopDb:ShopDb

In a loop,line I want to extract date part (2012-11-22 11:36:55) convert to time-stamp and assign to a variable(or simply dis
How to achieve this in bash ?

  • 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-14T17:06:06+00:00Added an answer on June 14, 2026 at 5:06 pm
    $ while IFS=" ," read f1 f2 f3
    > do
    >  echo $f1 $f2
    > done < file
    2012-11-22 11:36:55
    2012-11-22 11:37:00
    2012-11-22 11:38:01
    

    By setting the IFS to a space and comma makes it easy to extract the 1st 2 fields in the while loop.

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

Sidebar

Related Questions

I have this bash file, which asks for IP, password, etc. for OpenSSH to
So, I have a text file that is organized like this <username>:<fullname>:<usergroups> I need
I have a csv file like this: ELAPSEDTIME_SEC;CPU_%;RSS_KBYTES 0;3.4;420012 1;3.4;420012 2;3.4;420012 3;3.4;420012 4;3.4;420012 5;3.4;420012
I am new to bash so please bear with me if this is a
I'm quiet new to bash scripting, and I would like to convert recursively all
New to PHP and MySQL, have heard amazing things about this website from Leo
I have a bash file, which I’m trying to run in Cygwin on a
I have this: #!/bin/bash # Open up the document read -d '' html <<-
I am new to bash scripting and would like to write a bash script
I need to use bash to insert a line into a python file. This

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.