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

    Sort an Associative Array

    I think you need to write: for(inx in arrERRORS){ printf("---- %3d: %s\n",arrCOUNT[arrERRORS[inx]], arrERRORS [inx])| "sort -f -k2" } This will pipe your print through sort -- use -k(n) to sort on the right position (see man sort). jmagave
  2. jmagave

    Printing single quote in nawk in solaris2.8

    I'm not shure if nawk supports octal/hexa representation of ascii codes. If so, I prefer: echo | nawk '{for (i=0; i < 10; i++){ print &quot;CA\047s jose&quot; }' Where \047 is octal for 39 - ascii code of '. PS: I changed the for loop var :-) jmagave
  3. jmagave

    Removing duplicate lines in a file

    I would do it in AWK and some piping: awk '{lines[$0]=i++} END{for(j in lines) print lines[j],j} ' file1 | sort -n | cut -d&quot; &quot; -f2- Jayr
  4. jmagave

    separate humber from alphabets

    I should know *NIX had something, 'cause this sound pretty mundane task. I thought join could work, but it requires common fields. Alas, [code]paste[code] does the job (it even works on my cygwin). I do read man pages... but someone must tell you they exist for the needed task. A star to...
  5. jmagave

    separate humber from alphabets

    Hi all, A bit off-topic, but... I am brazilian, and I wish the best for my american friends on this 4th July. May God bless your nation (provided Bush don't mess up things too much :) Strength and Honor! Jayr Magave
  6. jmagave

    separate humber from alphabets

    Hi all, 1) I think CaKiwi`s solution is fine (it saves one function call which slows performance). I would change it to: AWK '{sub(/[0-9]+/,&quot;&quot;,$3); print $3; }' We removed the caret &quot;^&quot; which NEGATES the regex range. I think Murugs wants TEXT not...
  7. jmagave

    Insert text at beg of line &amp; remove leading zeroes from a field

    The requirement said: &quot; ...each line that *may* have 1 or 2 leading zeroes..&quot; To me *may* means may or may not. So your regex /0[1-9]+/ will match positive to &quot;1023&quot;, and the index() will miss the &quot;1&quot; before the &quot;0&quot;. I guess /^0[1-9]+/ would correct...
  8. jmagave

    Better Performance

    Coding calls to SPs can really improve your performance, as well as using Parameterized Queries, do. But you'll be tied to your vendor´s SQL dialect.
  9. jmagave

    Insert text at beg of line &amp; remove leading zeroes from a field

    Well, I would prefer: AWK 'BEGIN{ OFS=FS=&quot;,&quot; } {$3 = $3 + 0; print FILENAME,$0; } This will convert field $3 to Number and get rid of ALL leading Zeroes. Furthermore, IMHO your solution may mess with Zeroes INSIDE $3 Jayr Magave

Part and Inventory Search

Back
Top