I have not forgotten the Scope project as this has been bugging me and WILL be part of it...
(Note that the 8192 byte binary file can be any binary file of your choice but the values "m" and "n" will vary.)
They are correct in the demo and correct in the _finished_at_present_ product, but......
I am having one hell of a problem trying to beat 10 seconds to scan an 8KB binary file for the scope. A derivative of this WILL be used to determine the polarity of the DC component of a signal... However I WAS trying to make it usable as an Audio Frequency Counter.
I HAVE successfully done it for Python 2x and 3x and reads the frequency to an accuracy of 0.1 per cent but Shell scripting - time wise ONLY - has so far eluded me but the accuracy is still the same.
This is the result on screen and IS correct but it takes 10 seconds to get there... ;o(
Removing the comment and space from the line......
......shows how fast the resulting 24KiB file is printed to screen...
The results on my Macbook Pro:-
I have tried other methods but this has shaved at least 4 seconds of off the others...
A pointer in the right direction for any other method to speed this up at least 10 fold between START and DONE would really be appreciated...
If you are convinced that the 3 digit substrings in "$decimalstring" are in the range 0 through 255, the loop should run faster if you replace the two if statements with:
Have you compared the speed of $[ ( m + 1 ) ] versus $((m+1))?
This User Gave Thanks to Don Cragun For This Post:
The "if... then... else... fi" made no difference...
The "$((m+1))" seems to have shaved another 1/2 to 1 second, now down is single figures... ;o)
So it IS about 5 to 10 per cent faster...
Thanks for the heads up, hopefully there will be more ideas come my way but after using Python for the same thing I didn't realise how slow the shell could be in real time stuff...
bash has a well-deserved reputation for being slow. A few years ago, its poor performance led Ubuntu Linux to abandon it for boot scripts (although bash remains the default interactive login shell for users).
If you aren't wedded to bash, and if the scripts in question aren't brimming with bashisms, you could try running them under ksh (which was installed by default on OS X when I last used the OS, a few years ago).
If you use ksh instead of bash, you can also use the built-in {init..limit..inc} instead of spawning a separate process to evaluate $(seq init inc limit}. I.e.:
This User Gave Thanks to Don Cragun For This Post:
i have a string that am looking to extract all characters following 3 consecutiv numbers.
Example my string is J1705PEAN038TDMN, i need to get TDMN
My string can have multiple 3 consecutive numbers, i need what follows last occurance (9 Replies)
I'm making a little game in Perl, and I am trying to remove the first instance of a character in an arbitrary string. For example, if the string is
"cupcakes"and the user enters another string that contains letters from "cupcake" e.g:
"sake"the original string will now look like this (below)... (3 Replies)
Hi ,
I am getting a string like
aaa,bbb,sdsdad,sdfsdf,sdfsdfdsf,rtyrtyr,45654654,ddfdfdfgdfg,dfgdfgdg...........
Now what I need is to format it.
So after each nth comma I need one newline. So the above will look like
when n=3
aaa,bbb,sdsdad,
sdfsdf,sdfsdfdsf,rtyrtyr,... (4 Replies)
i have something like this...
echo "teCertificateId" | awk -F'Id' '{ print $1 }' | awk -F'te' '{ print $2 }'
Certifica
the awk should remove 'te' only if it is present at the start of the string.. anywhere else it should ignore it.
expected output is
Certificate (7 Replies)
Hi,
I have the followoing details in one file:
opt/tra/domain/test/new/filename1
training/ear/help
I need to manipulate the string in the following manner:
filename1= opt/tra/domain/test/new/filename1
help=training/ear/help
last string is the name and equal sign and then... (2 Replies)
Hi Guru's,
I need some help with data manipulation using shell scripting. I know how to replace the whole string but not part of the string.
The value after aa= should be replaced with the value in the mail leaving ,OU=111,OU=222,DC=333 as is. Below are the inputs and expected outputs.
Input:... (17 Replies)
if I have two string variable, how do I add one to anther.
like
a= "a"
b="b"
c=$a+$b
but that doesn't work.
Is there anyway to solve it.http://www.qtl.co.il/img/copy.pnghttp://www.google.com/favicon.icohttp://www.babylon.com/favicon.icohttp://www.morfix.com/favicon.ico (2 Replies)
i have a file that contains a pattern like this:
ajay 1234 newyork available
kumar 2345 denver
singh 2345 newyork
ajay 3456 denver
kumar 3456 newyork
singh 3456 delhi available
ajay 4567 miami
kumar 4567 miami
singh 4567 delhi
i want to search for each line... (5 Replies)
Hey Guys,
Right i know how to alter a word to begin with a capital letter, i know how to remove unwanted characters and replace them with the relevant character however i don't now if there is a way to do them all in one line.
Code:
echo -n ${string:0:1} | tr a-z A-Z #convert first letter... (4 Replies)
Hello,
I have a korn shell string variable
str1 = "A,B,Z"
I would like to create another korn shell string variable
str2 = "letter = 'A' or letter = 'B' or letter = 'Z' "
Please help!
Thanks in advance
an UNIX newbie! (13 Replies)