Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. AwkRookie

    comparing contents of new files - numerical example

    marsd, Sorry. Here's my example: file 1 ------ contains fields file1_field1 thru file1_field4 with numeric data (double-precision) as: file1_field1 file1_field2 file1_field3 file1_field4 16:00 10 20 30 16:10 40 50 60 16:20 12 23 14 file 2...
  2. AwkRookie

    comparing contents of two files (field comparison)

    marsd, Sorry. Here's my example: file 1 ------ contains fields file1_field1 thru file1_field4 with numeric data (double-precision) as: file1_field1 file1_field2 file1_field3 file1_field4 16:00 10 20 30 16:10 40 50 60 16:20 12 23 14 file 2...
  3. AwkRookie

    comparing contents of two files (field comparison)

    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...
  4. AwkRookie

    reading in HH:MM:SS versus ignoring it (doing ops on HH,MM,SS)

    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...
  5. AwkRookie

    Awk - reading in HH:MM:SS

    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...
  6. AwkRookie

    Re-post (of Re-post) of Awk question Aho p. 77

    Glanced over & saw &quot;check&quot; instead of &quot;uncheck&quot; - 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] =...
  7. AwkRookie

    Re-post of Awk (Aho, ...) page 68 question

    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(&quot;%g&quot;,sum) if (i<maxfld) printf(&quot;\t&quot;) else printf(&quot;\n&quot;) } } According to the Aho, Kernighan...
  8. AwkRookie

    Re-post of Awk Data Processing Question

    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...
  9. AwkRookie

    Data Processing in Awk

    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(&quot;%g&quot;,sum[i]) if (i<maxfld) printf(&quot;\t&quot;) else printf(&quot;\n&quot;) } } According to the Aho...
  10. AwkRookie

    Data Validation with Awk (Aho, Kernighan, Weinberger p.77)

    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...

Part and Inventory Search

Back
Top