I want to write a script which will compare field(s) from two different files. The data in these fields is numeric and I want to identify the row number and data element where there is a match.
I have sketched out some pseudo-code which may help explain my question; my explanations are denoted...
Now that I am able to read in a file with HH:MM:SS values (the first element in each row), if I want to perform operations on the hours, minutes, and seconds, how do I read in hours, minutes, and seconds separately, while still reading in all of the other numeric fields in each row?
For...
This is another post of the same code I've posted before with a different slant and some more verbage below it:
I'm attempting to run the following script from p.68 of the Aho, Kernighan, Weinberger bible:
{ for (i=1; i <=NF; i++)
sum[i] += $i
if (NF > maxfld)
maxfld = NF
}
END { for (i = 1...
Glanced over & saw "check" instead of "uncheck" - sorry.
I am using all-numeric data, tab-delimited, as input to the following code from top of p.77; is there any reason that this script should not run as typed?:
NR == 1 {
nfld = NF
for (i=1; i <=NF; i++)
type[i] =...
I am using all-numeric data, tab-delimited, as input to the following code:
{for (i=1; i<=NF; i++)
sum+=$i
if(NF>maxfld)
maxfld=NF
}
END {for (i=1; i<=maxfld; i++) {
printf("%g",sum)
if (i<maxfld)
printf("\t")
else
printf("\n")
}
}
According to the Aho, Kernighan...
Trying to run the script in Section 3.2, page 77 of 'Data Validation' in the Aho, Kernighan, Weinberger book. I have a set of data that is 8-column numeric as input that will read in without any errors but I get no output. What is the problem? Should the code below run without error and if it...
I am using all-numeric data, tab-delimited, as input to the following code:
{for (i=1; i<=NF; i++)
sum[i]+=$i
if(NF>maxfld)
maxfld=NF
}
END {for (i=1; i<=maxfld; i++) {
printf("%g",sum[i])
if (i<maxfld)
printf("\t")
else
printf("\n")
}
}
According to the Aho...
Trying to run the script in Section 3.2, page 77 of 'Data Validation' in the Aho, Kernighan, Weinberger book. I have a set of data that is 8-column numeric as input that will read in without any errors but I get no output. What is the problem? Should the code below run without error and if it...
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.