473,416 Members | 1,584 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

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

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 5238

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

Similar topics

4
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...
5
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...
3
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...
7
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...
2
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...
2
by: 06mca30 | last post by:
How to calculate total no of hits for my home page?
2
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,...
5
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...
5
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.