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 8894621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:32:53+00:00 2026-06-14T23:32:53+00:00

I am writing a bash script that connects to a server, exports data to

  • 0

I am writing a bash script that connects to a server, exports data to a .csv file and then runs a jar that uses that newly created file. The problem is, the jar requires the file name to include the value of the Timestamp column of the first row in the .csv file.

Here is the first line of my .csv file. In this case, the timestamp is 2012-11-01 located at the end of the row.

"####<Nov 1, 2012 12:00:01 AM UTC> <Warning> <AesoRMQAdapter::RabbitMQAdapter> <> <myServer> <[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'> <> <> <> <1351728001726> <BEA-000000> <DEBUG SEND MESSAGE={"Volume":55.1,"OfferedVolume":54.8,"ArmedVolume":0.0,"Status":false,"BlockNr":0,"Timestamp":"2012-11-01T00:00:01+0000"}> "

My question is as followed.

How can I, after retrieving the .csv file…

  1. Grab the first timestamp from the first row in the .csv file
  2. Use that timestamp in a filename that I’ll be saving the .csv file under

I appreciate all of your help!

  • 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-14T23:32:54+00:00Added an answer on June 14, 2026 at 11:32 pm

    Use head -1 to get only one line from your input file, then grep -o to retrieve all timestamps in this line then head -1 to keep only the first one.

    $ date=`cat myfile.csv | head -1 | grep -o -e "[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}" | head -1`
    $ echo $date
    2012-11-01
    $ mv myfile.csv myfile.$date.csv
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a bash script that encrypts the data of a folder or file
I'm writing a bash script that automatically deploys an application to a tomcat server.
I am writing a bash script that uses calling syntax script [options] [dir] To
I am writing some BASH shell script that will continuously check a file to
I'm writing a bash script that will (hopefully) redirect to a file whose name
I am writing a bash script that modifies a file that looks like this:
I am writing a bash script that will output a .tgz file to a
I'm writing a bash script that will download the page then search for a
I'm writing a bash shell script that uses a case with three options: If
I am writing a bash script to copy a file from a remote server,

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.