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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:08:31+00:00 2026-06-12T14:08:31+00:00

I have a report same as below content: gold 1 1986 USA Americal Eagle

  • 0

I have a report same as below content:

gold     1      1986    USA                 Americal Eagle
gold     1      1908    Austria-Hungary     Franz Josef 100 Korona
silver  10      1981    USA             Ingot
gold     1      1984    Switzerland         ingot
gold     1      1979    RSA                 Krugerrand
gold     0.5    1981    RSA                 Krugerrand
gold     0.1    1986    PRC                 Panda
silver   1      1986    USA                 Liberty dollar
gold     0.25   1986    USA                 Liberty 5-collar piece
silver   0.5    1986    USA                 Liberty 50-cent piece
silver   1      1987    USA                 Constitution dollar
gold     0.25   1987    USA                 Constitution 5-dollar piece
gold     1      1988    Canada              Maple Leaf

I want to extract a report like below:

Gold pieces:                    9
Weight of gold pieces:           6.10
Value of gold pieces:       9729.50

this the code I’ve made:

BEGIN{}
$1 ~/^gold$/
{
  goldWeight += $2
  ++goldCounter
}
END{
  printf "Gold Pieces:\t\t%d\n" , goldCounter
  printf "Weight of gold pieces:\t\t%1.2f\n" , goldWeight
  printf "Value of gold pieces:\t\t%1.2f\n" , goldWeight*1771.00
}

the code does not work. where is my problem?

  • 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-12T14:08:33+00:00Added an answer on June 12, 2026 at 2:08 pm

    You need the first bracket after the pattern

    $1 ~/^gold$/ {
      goldWeight += $2
      ++goldCounter
    }
    

    Then the bit in braces applies to the pattern. Otherwise it applies to every line.

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

Sidebar

Related Questions

Is it possible to have 2 report parameters set the same actual parameter? For
Have deployed numerous report parts which reference the same view however one of them
We have the below requirement. We will have to create an excel/pdf report and
I have two methods General and SearchTab below. When I look at my report
I have a file reflog with the content as below. There will be items
I have multiple BIRT reports that obtains the data from the same jdbc data
I have this code private void writeReport(IReport report, string reportName) { string reportString =
I have a report that is getting info from bsis, bsas, bsid, bsad, vbrk,
I have a report like this person | lead count | support count |
I have a report in which I want to display value of 2 engineers

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.