Search Results

Search: Posts Made By: Eric7giants
3,107
Posted By RudiC
I'm afraid, no. You've been shown in your other...
I'm afraid, no. You've been shown in your other thread (https://www.unix.com/303040608-post2.html) that division by 0 is possible in your context and the reason therefor. And, looking at your sample...
2,212
Posted By Neo
Dear Eric7giants, Thanks for posting these...
Dear Eric7giants,

Thanks for posting these programming challenges.

Cross language coding and lateral thinking is really important to increase cognitive skills and technical abilities.
2,562
Posted By stomp
Your task is pretty basic. You will find a lot of...
Your task is pretty basic. You will find a lot of examples if you...

... search google for "perl read from stdin" ...
... read the documentation for the functions, e. g. perldoc -f split

I do...
2,680
Posted By jim mcnamara
Your turn next: I got your awk code to run...
Your turn next:
I got your awk code to run against a dummy input file. I cannot see why your sample ran for you - however after fixing syntax I got an awk source file t.awk. t.lis is the file...
1,935
Posted By RudiC
In the END section, you're using b as the loop...
In the END section, you're using b as the loop variable but use $1 for building the indices. Won't fly.
And, if one or more of the categories don't exist for a student, their total array element...
2,945
Posted By vgersh99
why are you using total in 2 diff context? ...
why are you using total in 2 diff context?
total[$1] += $5
and
total=Homework+Lab+Final+Quiz+Survey
Also sum[$1] += $4 is indexed by a single index - not by $1$2
3,455
Posted By MadeInGermany
In the shell you can do awk -f average1.awk...
In the shell you can do
awk -f average1.awk "$1" | (read h; echo "$h"; sort)
Within the awk script you can do something like
NR==1 {print}
... {print | "sort"}
3,082
Posted By RudiC
You didn't say so in your spec... How about ...
You didn't say so in your spec...

How about

awk '
BEGIN {FS = ","
}
{for (i=1; i <= NF; i++) {if ($i<10) T = $i
else ...
3,082
Posted By RudiC
Try awk -F, ' {for (i=1; i <= NF;...
Try
awk -F, '
{for (i=1; i <= NF; i++) print $i<10?$i:10
}
' file
5
10
10
10
8
3
9
10
10
3
10
Showing results 1 to 9 of 9

 
All times are GMT -4. The time now is 03:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy