Quote:
with the floating point numbers came from ... 3rd time I'm asking about the same thing in slightly different words. Code:
*plym fury 1970 73 2500 1.825 And please wrap your file content in code - tags to preserve spacing, makes it much easier to read. Cheers, Tink |
Quote:
I've spent about five hours on this today and still having no luck with that part. |
Quote:
make those figures produce the result you computed manually in your desired output. So which columns did you use to make the floats up? With your input I can't make up an algorithm .... Cheers, Tink |
Some of the numbers seem off, I'm going to double check this and then post again!
|
Ok, so 4th column is miles, 5th column is price and and the proposed 6th is to be calculated as miles/age of the car for miles per year.
|
Quote:
Code:
awk -v year=1999 '$3<year{printf "*"}{print $0" "$4/(strftime("%Y")-$3)}' cars Cheers, Tink |
THANK YOU SO MUCH!!!!!
That was extremely helpful!!!!! |
Just wanted to thank you again man!!!! Thank you to everyone else who contributed as well!
|
After replacing "year=1999", instead with "year=$1" it workings swimmingly!
Now to see if I can beautify the columns a bit! |
Quote:
Cheers, Tink |
Well just so you can see alternatives:
Code:
awk -vy=1999 '$0 = (($3 < y)?"*":"")$0" "$4/(strftime("%Y")-$3)' cars | column -t |
Awesome!!! Thanks a ton Tinkster!!!
Thank to you too grail! That's kind of interesting as well, it's kind of cool how there are multiple ways of solving the same problem with Linux! Learned something new with column -t as well! Thanks man!! |
All times are GMT -5. The time now is 06:56 PM. |