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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by ranjit

  1. ranjit

    HACMP config change

    Madra, Not sure if you did get a solution to the initial post. If I understand correctly you have two resource groups (rgA and rgB). rgA - is to be capable of failover to from NodeA -> NodeB rgB - should remain on NodeB and never move The easiest way to achieve this is to change the...
  2. ranjit

    HACMP and SNMP traps

    How is HACMP configured to use SNMP traps?
  3. ranjit

    get uniq hour:minute lines

    Perhaps ... awk '!a[substr($2,1,5)] {print; ++a[substr($2,1,5)]}' data 2008-02-26 18:06:00 s1 2.03 2008-02-26 18:11:00 s1 2.02 2008-02-26 18:16:00 s1 1.97 2008-02-26 18:21:00 s1 1.92 2008-02-26 18:26:00 s1 3.77 2008-02-26 18:31:01 s1...
  4. ranjit

    AWK ... Delete first 56 lines of a file

    Perhaps using an array: $ cat script {a[NR]=$0} END { for(i=57;i<=NR;i++) print a[i] } $ awk -f script datafile
  5. ranjit

    Removing lines from log file

    $ awk '$0 ~/1751|141/ || /1753|142/ {print}' data |1751|141|1 |1|85|1|41|47|0|0|0|0|0|0|54|319|667|509|177|54|17|3|1|0|1|0|0|0 |1753|142|1 |1|0|0|20|16|3|7|1048|512|144|80|16|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
  6. ranjit

    Solaris and awk

    Is the "[^[:alnum:]]" notation for specifying a field seperator valid for Solaris? echo "AA!BB,CC DD" | nawk -F "[^[:alnum:]]" '{print $3}' The above works on AIX however not on Solaris
  7. ranjit

    Print output with variable leading zeros

    Thanks PHV
  8. ranjit

    Print output with variable leading zeros

    Mike, Are you sure variable assignment within printf works? $ cat test.awk nawk 'BEGIN { LENGTH=6 printf("%0${LENGTH}d\n", "123") printf("%08d\n", "123") }' $ ./test.awk {LENGTH}d 00000123 I didn't get the result you suggested. Thanks
  9. ranjit

    Print output with variable leading zeros

    Thank you Mike
  10. ranjit

    Print output with variable leading zeros

    I have a requirement to increment a number prefixed with variable leading zeros and print the output. Input: 0012 000005 000099 0000100 Desired output: 0013 000006 000100 0000101 I'm fine if the output is required to be say 5 digits in length i.e using printf "%05\n" - the variable length per...
  11. ranjit

    awk help

    Sorry tested on AIX. Maybe try nawk?
  12. ranjit

    awk help

    Perhaps this .. # awk 'BEGIN {FS="," ; RS="\n" } { printf("%s%s", $0,ORS=(FNR%6)?FS:RS) }' data paeq45:27502,112.26.259.35,20502,tcp,tcp,active watp45:23564,157.72.135.35,40204,tcp,tcp,active rupp47:20225,135.42.224.37,10605,tcp,tcp,active
  13. ranjit

    Looking to run an AWK script that is too slow in Perl?

    Perhaps this... $ cat script /[A-Z]/ { b=sprintf("%s", substr($6,index($6,"=")+1,5)) a=sprintf("%s", substr($7,index($7,"=")+1,5)) if(a<b) {print $0} } $ cat data 07:07:05.048 I: QFEED: S=BOL P=44.25 B=23.5 A=15.43 SZ=4200x1500 L=0 D=0(42) CD=0 N=1 07:07:05.048 I: QFEED: S=BOL P=44.25 B=23.5...
  14. ranjit

    Interactive input and awk

    PHV, Many thanks - that's done the trick.
  15. ranjit

    Interactive input and awk

    How would I use awk in an interactive manner? That is, prompting for user input...doing a calculation and re-prompting? BEGIN { while (ARGC<3) { print sqrt(ARGV[1]) } } I looking for somthing like this however i don't know how to re-read in user input or an exit statement to break the loop.

Part and Inventory Search

Back
Top