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

    One of the most frustrating AWK programs

    Your frustration is valid, but that is the purpose of writing obfuscated programs. Anyways I think we have beaten this dead animal far too much. It'd have been nice to put the comparison operator instead of the assignment one but since the latter evaluates to true for each line, they're all printed.
  2. skillaci

    One of the most frustrating AWK programs

    There is nothing wrong with the script below, save that it is an example of obfuscated awk scripting. A = "a" B = "b" { } END { print A, B } Moreover, it is semantically different from the script that you've posted although it looks syntactically similar to the one you're talking about.
  3. skillaci

    Help with an awk script to filter tables

    Here's a different awk recipe: awk -F"[\t]|[(]|[)][,]?" '{ for (i=1;i<=NF;i++) x[$1] = (i==1 ? $1 : (i%2 ? x[$1] ";" ($i > 0.8 ? $(i-1) : "low") : x[$1])) n=split(x[$1],a,";") for (j=n;j<5;j++) x[$1]=x[$1]";na" } END {for(i in x) print x[i]}' file
  4. skillaci

    merge two lines - parent+child processes

    See if this awk command will work for you: awk '{c[$2]++;l=$0;gsub("^[0-9]+ *[0-9]+ *","",l);pid[$1]=l;ppid[$2]=(ppid[$2]?ppid[$2] " " l : l)}END{for(i in ppid) if (i in pid) {pid[i] = pid[i]" "ppid[i];print i, pid[i]}}' file
  5. skillaci

    Summary and average per minute

    Time calculations are normally best done in perl due to its builtin libraries, but that is just my 2c...
  6. skillaci

    awk bug in Solaris 10? awk and nawk return incorrect integer in $NF

    Try forcing a numerical output by... nawk '{if (NR==2) print $NF+0}']

Part and Inventory Search

Back
Top