Well, I suspect that this is one of those "if it ain't broke, don't fix it" moments. I always find it hard to tell but I suppose this could be my OCD is acting up, I just can't leave this alone.
In the GAWK version of the script, this is where things get funky
close(out1)
if (frac>0) {...
I did the calculations and by putting close(out1) after the while function the calculations are correct in the Mac version. Though by doing the same in the GAWK version, this works but produces values for the calculations in the while function that are not correct. Any guess as to why this is?
It did, thanks for this. Though this raises another question seeing as when I run the "new" modified working script with Mac AWK, the results are exactly the same as with the GAWK version (except for . and ,). Though if I change the GAWK version to place close(out1) after the while function...
Hi all!
I have a problem with an AWK-script that I wrote a few years ago with a lot of help from people in this forum.
It’s basically pretty simple, it is supposed to extract some columns from output obtained from analyses of simulations. After obtaining the interesting columns from the...
AWSOME!!!!!!
Man I feel like a dumba**!
So, now I should definitely have all I need to do some serious analysis of my simulations in no-time!
I really cannot thank you both enough, you have no idea how useful this is to me!!! (And everyone else riding piggyback on this script here).
I'll try...
Hello again
So, one of my co-workers expressed a wish to have all the "out2" files, the "summary" files put into 1 file as a list. Of course I thought that this would be an even lazier approach to what I'm doing and therefore got very enthusiastic. So, I figured this would be very easy, and of...
I got it twisted! Just jumped to the conclusion that this had something to do with the shell-based getline in the previous files I had been working on! Thank you very much for clarifying!
Obviously, there is much room for improvement, I have checked and double check the output and the math...
Sorry, I guess my poor "computer speak" is causing me more problems, as usual!
Obviously I should be more suspicious since it doesn't work without the while function. But, to highlight my lacking skills, what is "getline"actually extracting from out1 that needs to be larger than 0? And should...
Back again!
I was trying to clean up the script from things I thought was unnecessary, and I ran into a problem.
By removing
while ((getline<out1)>0)
The
if (denom>1) {
sd_lt=sqrt(tottsq/(denom-1)); semlt=(tottsq/(denom-1))/(sqrt(denom))
printf " SD lifetime...
Sorry for the somewhat dumb question, you already specified the "reset" for me, just didn't catch that one.
This is what it looks like now, and it seems to be working fine!
BEGIN { ref_mol=10 }
FNR==1 && NR!=1 { endfile(); tott=tothb=tottsq=denom=0 }
FNR==1 { out1="hb_%_occ_"FILENAME...
I found the effect, the sd_lt and semlt and or denom values gets screwed up somehow.
if (denom>1) {
sd_lt=sqrt(tottsq/(denom-1)); semlt=(tottsq/(denom-1))/(sqrt(denom))
printf " SD lifetime: %10.3f\n",sd_lt > out2
printf " SEM lifetime...
Now the "x=" message gets printed, though the script stopped after 21 input files:
/usr/bin/awk: summary_hb_bot_o2_pab_h5.out makes too many open files
input record number 1, file hb_bot_o3_pab_h1.out
source line number 33
So, even I could figure out that I was not closing all the...
Got it, so current record nr is 1, overall is not 1 and both criteria must be met! I guess I'm not a complete fool since there was some truth to the "premature" termination idea.
I tell ya', sometimes I think that a couple of courses in programming would have been of more use then the...
Good morning!
Well, after digging around, trying different input files and so on, there are two things that remain to solve.
PHV -> return instead of exit gives me:
/usr/bin/awk: hb_%_occ_hb_bot_n2_pab_h5.out makes too many open files
input record number 1, file hb_bot_o1_pab_h1.out...
Tanks a bundle for clarifying!
I have my weekend cut out for me making sure that the code works on all different workstations and servers!
I love this forum, everyone is so helpful! It is amazing! Lots of thumbs up for everyone helping me get more work done in a steadily decreasing amount of...
This is just my lacking programming skills shining thorugh, in one scipt the inp_num was defined by the user upon execution of the script in the terminal view so that the user would not have to open and modify the script, now I just input the number directly in the script.
If i specify...
Thank you very much! I'll dive right into this!
I was just reading about the close function trying to figure out the output handling. So this was also what I was going to ask about! Though I have one more question, as you can see i have a "getline" which I forgot to erase, the...
Well, sadly there are multiple versions since I'm running it locally on my Mac (BSD version), on two different clusters/servers with different GAWK versions, one of which is only 3.1.5. So I guess BEGIN/ENDFILE is out of the question.
It is important that this script runs without...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.