From ankoa, 9 Months ago, written in Plain Text.
This paste is a reply to awk environment from ankoa - view diff
  1. ---- test script
  2.  
  3. #!/bin/bash
  4. # test environment
  5. export CLIENT1="name1,1.1.2.1,secret1"
  6. export CLIENT2="name2,2.1.2.2,secret2"
  7. export CLIENT3="name3,3.1.2.3,secret3"
  8.  
  9. awk -f env.awk
  10.  
  11.  
  12. --- env.awk (cleaned up)
  13.  
  14.  
  15. BEGIN {
  16.   print "(allowedClients"
  17.   for (i in ENVIRON){
  18.      if (i ~ "CLIENT[0-9]*") {
  19.        split(ENVIRON[i],field,/,/)
  20.        printf("  (%s %s %s)\n",field[1],field[2],field[3])
  21.       }
  22.   }
  23.   print ")"
  24. }
  25.  
captcha