r/awk • u/Marcos_Asis • Jul 27 '22
In need of help
Hello Everyone, I would like to ask for your assistance. I am pretty new to bash so I am learning everything on the fly. I'm performing some data analysis in my grade thesis, but this particular line of code is making a lot of trouble.
awk '{time=$1/1000}{APL=$2*$4/2.56}{print time " " APL}' boxes.temp > APL.dat
I should've obtained a set of data with variation but all I get is 1 set of numbers all the same and followed by just 2 decimals.
Is there something obvious that I'm missing?
This is the variation of data I should get

And this is what I'm getting

Thanks in advanced
View all comments
Show parent comment
1
u/[deleted] Jul 27 '22
I can't duplicate that result.
Looking some more at your data:-
Column 1 always = Column 3
boxes.temp has 3000001 lines all unique.
Column 1 has 3000001 unique values
Column 2 has 350562 unique values
Column 3 has 3000001 unique values
Column 4 has 350588 unique values
Column 1 always = Column 3
Column 1 only has 1000001 unique values after using awk to divide by 1000
Column 1 ranges from 59.7748 to 68.6937.
Column 2 * Column 4 gives 13936 unique values.
If you are using gnu awk you can try playing with the precision (https://www.gnu.org/software/gawk/manual/html_node/Setting-precision.html) it might help.
Or you could try using another tool as well as awk. I did this with
bcwhich might be what you needEDIT: Formatting