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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:33:42+00:00 2026-05-11T03:33:42+00:00

I want to shift away from Excel to Awk. I need basic mathematical operations,

  • 0

I want to shift away from Excel to Awk. I need basic mathematical operations, such as addition and division, for arrays.

For example, arrays A and B are [1, 3, 2] and [2, 1, 2], respectively. How can I get an array [2, 3, 4] from the multiplication between A and B? What about the addition and division between A and B?

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T03:33:42+00:00Added an answer on May 11, 2026 at 3:33 am

    I think awk is not done for this sort of numeric work. It’s more for text processing. Arrays in awk are associative and sparsely occupied (may have ‘holes’ between its indexes). You use strings to index them:

    for(int j=0; j<length(A) && j<length(B); j++)     C[j] = A[j] * B[j] 

    It’s like a hash-map. So, in awk you can do

    A[100] = 10; A[1] = 2; 

    And have only 2 elements stored in that array (elements from 2 to 99 do not exist), indexed by strings that are created by converting the numbers 100 and 1. The GNU Awk manual has a nice section about arrays in awk here.

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

Sidebar

Related Questions

Want to run javascript function from parent window in child window Example I have
I've got a really big number: 5799218898. And want to shift it right to
Let's say I want to bit shift i twice to the left and store
I want to send a textarea's data when user presses shift + enter ,
Want to open firefox from terminal at linux with firebug enabled // Terminal $
Ok, I need keys to be preserved within this array and I just want
I want to shift the contents of an array of bytes by 12-bit to
I want to shift a text label down by about 6px I am attaching
I have a few hundred symlinks I want to shift location for. Right now
want to open pdf file when a user clicks on hyperlink shown in gridview

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.