DEV Community

Brian Bills
Brian Bills

Posted on

awk total records processed

Hi All,

I would like to add several lines to the output of my script. Currently, the script behaves as outlined in the README.md file here. But the behavior I want to change it to is below:

./sample.sh -s 0-9 -c 0-3 -t samples.bin
                Ch0     Ch1     Ch2     Ch3
Sample 0:       0x1a03  0x1a03  0x4a03  0x5703
Sample 1:       0x4b03  0x4403  0x1e03  0x0904
Sample 2:       0x1003  0x1903  0x4003  0xae03
Sample 3:       0x1e03  0x2603  0x3303  0xad03
Sample 4:       0x1003  0x8403  0x4303  0x6203
Sample 5:       0xe003  0x1603  0x3403  0xc403
Sample 6:       0xf802  0x3b03  0x5303  0x6103
Sample 7:       0x1003  0x1503  0x4203  0x5803
Sample 8:       0x2303  0x1f03  0x5703  0x6203
Sample 9:       0x1703  0x7303  0x3103  0x3303
Total Samples in Record:        374371
Total Samples Processed:        10
Enter fullscreen mode Exit fullscreen mode

and here:

./sample.sh -r samples.bin
Total Samples in Record:        374371
Enter fullscreen mode Exit fullscreen mode

and here:

./sample.sh -t samples.bin
Total Samples in Record:        374371
Total Samples Processed:        374371
Enter fullscreen mode Exit fullscreen mode

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,
Brian

Top comments (0)