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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:20:11+00:00 2026-06-18T01:20:11+00:00

I am just new to the script language. Now I have a file, inside

  • 0

I am just new to the script language.

Now I have a file, inside it are:

>   A1 B1 C1
>   A2 B2 C2
>   A3 B3 C3

I just want to use the shell script(bash) to read the file element by element. Then I want to do some calculation of the element A1, A2 and A3 and then write them back to a new file(or the old file). So the new file would be (supposed the calculation results are D1,D2 and D3):

 D1 B1 C1
 D2 B2 C2
 D3 B3 C3

The calculation is to convert the Unix epoch time(A’s value) into human readable time(D’s value) by command “date -d @(A’s value)”.

I try to use the awk command:

awk '{$1=`date -d @$1`}' test.txt

But it seems to have some syntax error:> The error is :

awk: {$1=`date -d @$3`}
awk:     ^ invalid char '`' in expression
  • 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-18T01:20:12+00:00Added an answer on June 18, 2026 at 1:20 am

    your requirement is so unclear! what calculation did you mean?

    I could show you an example, hope it helps:

    kent$  cat test.txt
    100 B1 C1
    200 B2 C2
    300 B3 C3
    
    # in this example, the "calculation" is getting the squre of A1
    kent$  awk '{$1*=$1}1' test.txt
    10000 B1 C1
    40000 B2 C2
    90000 B3 C3
    
    #If you want to get the result in a newfile.txt, do this:
    
    kent$  awk '{$1*=$1}1' test.txt >newfile.txt
    
    #then
    
    kent$  cat newfile.txt 
    10000 B1 C1
    40000 B2 C2
    90000 B3 C3
    

    Edit

    here I could give you an example how to invoke date in awk:

    kent$  echo "1359579362 B1 C1"|awk '{"date -d @"$1|getline $1}1'                                                                                                            
    Wed Jan 30 21:56:02 CET 2013 B1 C1
    

    I guess that is what you are looking for.

    good luck.

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

Sidebar

Related Questions

I am just new to programming in Unix and have a small issue that
I am just new in MVC 3. I have a html view which contain
So i have just set new Error Handlers in httpd.conf for custom error pages:
Just I am new to Object Modelling.I want to know still there is a
i have installed ckeditor into my asp.mvc project, now i need to implement just
I'm new to ASP.NET but have quite a few successful test pages going now
I have been at this quiz for ages now and just can't get it
i have this: <%@ Control Language=C# Inherits=System.Web.Mvc.ViewUserControl<string> %> <script src=<%=Url.Content(~/Scripts/ckeditor/ckeditor.js)%> type=text/javascript></script> <script type=text/javascript> $(document).ready(function()
I'm writing an install script utilizing the NSIS installer scripting language. I have a
Consider following script (it's total nonsense in pseudo-language): if (Request.hostMatch(asfasfasf.com) && someString.existsIn(new String[] {brr,

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.