473,657 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I would like to use awk to calculate the total number of records processed

1 New Member
I would like to add several lines to the output of my script. Currently, the script behaves as outlined in the README file here. But the behavior I want to change it to is below:
Expand|Select|Wrap|Line Numbers
  1. ./sample.sh -s 0-9 -c 0-3 -t samples.bin 
  2.                 Ch0     Ch1     Ch2     Ch3 
  3. Sample 0:       0x1a03  0x1a03  0x4a03  0x5703 
  4. Sample 1:       0x4b03  0x4403  0x1e03  0x0904 
  5. Sample 2:       0x1003  0x1903  0x4003  0xae03 
  6. Sample 3:       0x1e03  0x2603  0x3303  0xad03 
  7. Sample 4:       0x1003  0x8403  0x4303  0x6203 
  8. Sample 5:       0xe003  0x1603  0x3403  0xc403 
  9. Sample 6:       0xf802  0x3b03  0x5303  0x6103 
  10. Sample 7:       0x1003  0x1503  0x4203  0x5803 
  11. Sample 8:       0x2303  0x1f03  0x5703  0x6203 
  12. Sample 9:       0x1703  0x7303  0x3103  0x3303 
  13. Total Samples in Record:        374371 
  14. Total Samples Processed:        10 
and here:
Expand|Select|Wrap|Line Numbers
  1. ./sample.sh -r samples.bin  
  2. Total Samples in Record:    374371
and here:
Expand|Select|Wrap|Line Numbers
  1. ./sample.sh -t samples.bin  
  2. Total Samples in Record:    374371  
  3. Total Samples Processed:    374371
The script works as expected, I just want the argument -r to replace -t and passing -t after -s and -c, should produce the total number of samples processed along with the total number of samples in the input file. I should still be able to pass -t to sample.sh, but in this case, it will count the number of samples in the file and tell us the total number of samples processed. The script is here. If you want you can clone the project and then do a pull request, and if the solution works, I'll approve it.

Thanks so much for your help,

Brian
Aug 25 '22 #1
0 5248

Sign in to post your reply or Sign up for a free account.

Similar topics

4
12673
by: John | last post by:
hey all..... alright, I am frusterated to the point of throwing my machine out the window (this board went down, trying to find stuff on google, this has been a nightmare) so I hope you guys can help me with a solution. This is what I am trying to do: Pretty much, there are two dates in my database, a start date, and an end
5
1774
by: Quentin Huo | last post by:
Hi: I want to retrieve a set of records from the query like: "SELECT * FROM tVisitors WHERE vTime>'1/1/2004'" And then I will put a part of records into a DataSet by: DataSet ds = new DataSet();
3
6901
by: JDiamond | last post by:
Hi, I have a table called Hosts. The Hosts table contains the following fields: Each field represents a step in the project. The tech that completes each step initials the respective columns using a combo box within a form. These initials are stored in an engineer table in which the combo
7
3078
by: john | last post by:
I have a form with 1 table. I would like to create a field in my form that shows the number of records (of the whole table) that have one particular value. Is that possible? I fiddled with a calculated field but I couldn't make it work. Thanks in advance, john
2
4603
by: msch-prv | last post by:
Hi, I have a paged gridview (Apts_grd) tied to an Access DataSource (Apts_srcGrd). How do I get the total number of data records returned by the query? The following shows only the number of records per page: Apts_srcGrd.SelectCommand = "SELECT * FROM tblApts WHERE ..." Apts_grd.DataBind() Response.Write("Count: " + Apts_grd.Rows.Count.ToString
2
4659
by: 06mca30 | last post by:
How to calculate total no of hits for my home page?
2
1933
by: APEJMAN | last post by:
HI I am trying to find out the total number of recoreds in a Hash Table. I am trying to write a function to calculate the total number of the recored in the Hash Table here is what I figure out, but I am confused now ( my code in incomplete) would you please guid me? Thanks template <typename T,typename K> int HashTable<T,K>::countRecords(HashTable<T,K> myHash){ //The number of records in the table: countRecords() int num_recored=0;
5
1371
by: SPC Camp | last post by:
I am trying to build a db to report the deficiencies/strengths of security. We have about 1000 criterion that we base these on. I am trying to set it up to where we can specify which criteria they are deficient in, and it will report the total number of deficiencies that section has. i have tried to do this with a yes/no field, and code that looks a little like this: Sum((+++++)*-1) in order to calculate the total number, but you can see how...
5
1728
by: Mmmel | last post by:
Hi! I'm sure that this is easy, but I just can't solve it. Could you please help? Access 2010 I have a form that displays all students in my program and all classes that they take, kind of like this: STUDENT ID CLASS MARK All I want to do is create a calculated field that displays the total number of classes that student is taking, like this:
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.