<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Awk Programming help in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976984#M99374</link>
    <description>SEP - can you go to chat?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.cmve.net/voc/voc.php" target="_blank"&gt;http://www.cmve.net/voc/voc.php&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 03 May 2006 11:04:37 GMT</pubDate>
    <dc:creator>Geoff Wild</dc:creator>
    <dc:date>2006-05-03T11:04:37Z</dc:date>
    <item>
      <title>Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976976#M99366</link>
      <description>I can probably figure this out - but I have to generate a list in lees then 2 hours...&lt;BR /&gt;&lt;BR /&gt;I have input from a command like so (for hundreds of users):&lt;BR /&gt;&lt;BR /&gt;Username:                              DS_UNIX_SERVERS:gwild&lt;BR /&gt;User ID:                               29125&lt;BR /&gt;User Class:                            DS_UNIX_ADMIN&lt;BR /&gt;Group ID:                              4&lt;BR /&gt;Comment:                               Geoffrey Wild - DS Unix Admin&lt;BR /&gt;Home directory:                        /home/gwild&lt;BR /&gt;Shell:                                 /bin/ksh&lt;BR /&gt;File permission mask (umask):&lt;BR /&gt;Program Search Path:&lt;BR /&gt;Start Program:&lt;BR /&gt;Inactivity timeout:                    0 minutes&lt;BR /&gt;Time dependent timeout:                no&lt;BR /&gt;Inactivity timeout checking:           CPU, keyboard, screen&lt;BR /&gt;Forced (hard) one-time password:       yes&lt;BR /&gt;Serial number of Password Generator:   1234&lt;BR /&gt;Type of password generator:            SecurId&lt;BR /&gt;Password last changed:                 03/24/03&lt;BR /&gt;Password valid until:                  04/22/07&lt;BR /&gt;User valid until:                      03/23/07&lt;BR /&gt;Last login:                            05/01/06 15:16:42&lt;BR /&gt;Last logout:                           05/02/06 14:20:26&lt;BR /&gt;Number of failed logins:               0&lt;BR /&gt;User blocked:                          no&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I need to print it like:&lt;BR /&gt;&lt;BR /&gt;Host Group  Userid   User Class   Password Expires   Password Generator&lt;BR /&gt;DS_UNIX_SERVERS   gwild    DS_UNIX_ADMIN    04/22/07   SecurId&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks...Geoff</description>
      <pubDate>Wed, 03 May 2006 10:18:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976976#M99366</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-05-03T10:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976977#M99367</link>
      <description>Geoff,&lt;BR /&gt;&lt;BR /&gt;You need to do the following&lt;BR /&gt;&lt;BR /&gt;cat filename | egrep -i 'username|user id|user class|password valid until|type of password generator' | \&lt;BR /&gt;awk -F: '{a=$2;getline;b=$2;getline;c=$2;getline;e=$2;getline;d=$2;print a,b,c,d,e}'&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ninad</description>
      <pubDate>Wed, 03 May 2006 10:33:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976977#M99367</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-05-03T10:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976978#M99368</link>
      <description>Maybe something like-&lt;BR /&gt; &lt;BR /&gt;awk -F: '/^Username/{host=$1;userid=$2};&lt;BR /&gt;/^User Class/{userclass=$1};&lt;BR /&gt;... repeat above for each data item you want&lt;BR /&gt;/^User blocked/{print host,userid,userclass,...}' inputfile&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 03 May 2006 10:35:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976978#M99368</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2006-05-03T10:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976979#M99369</link>
      <description>Geoff,&lt;BR /&gt;Sorry small correction&lt;BR /&gt;&lt;BR /&gt;cat filename | egrep -i 'username|user id|user class|password valid until|type of password generator' | \&lt;BR /&gt;awk -F: '{a=$2;b=$3;getline;c=$2;getline;e=$2;getline;d=$2;print a,b,c,d,e}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Ninad</description>
      <pubDate>Wed, 03 May 2006 10:37:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976979#M99369</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-05-03T10:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976980#M99370</link>
      <description>Geoff,&lt;BR /&gt;Sorry small correction&lt;BR /&gt;&lt;BR /&gt;cat filename | egrep -i 'username|user class|password valid until|type of password generator' | \&lt;BR /&gt;awk -F: '{a=$2;b=$3;getline;c=$2;getline;e=$2;getline;d=$2;print a,b,c,d,e}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Ninad</description>
      <pubDate>Wed, 03 May 2006 10:41:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976980#M99370</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-05-03T10:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976981#M99371</link>
      <description>Here is a version that picks each data item out by the leading pattern.  It just substitutes a space for the : in the "Host Group Userid" pair.  It didn't seem worth parsing them out into two separate variables.  The output is triggered by getting a "Password valid until:" line.&lt;BR /&gt;That presumes the fields are always in the same order.  It will handle a file that contains the same pattern repeated for many users.&lt;BR /&gt;&lt;BR /&gt;BEGIN{print "Host Group Userid User Class Password Expires Password Generator"}&lt;BR /&gt;/^Username:/{Username=$NF ;sub(":"," ",Username)}&lt;BR /&gt;/^User Class:/{UserClass=$NF}&lt;BR /&gt;/^Type of password generator:/{PasswordGenerator=$NF}&lt;BR /&gt;/^Password valid until:/{PasswordExpires=$NF;&lt;BR /&gt;    print Username " " UserClass " " PasswordExpires " " PasswordGenerator}&lt;BR /&gt;</description>
      <pubDate>Wed, 03 May 2006 10:47:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976981#M99371</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2006-05-03T10:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976982#M99372</link>
      <description>Ninad - close...just need to format...&lt;BR /&gt;&lt;BR /&gt;Rodney - havn't tried it yet...&lt;BR /&gt;&lt;BR /&gt;Mike - yours looks interesting...&lt;BR /&gt;&lt;BR /&gt;Just so you know, it isn't a filename - but output from a command...&lt;BR /&gt;&lt;BR /&gt;Something like:&lt;BR /&gt;&lt;BR /&gt;lsbks -a -l $i | awk...&lt;BR /&gt;&lt;BR /&gt;where $i is DS_UNIX_SERVERS:gwild&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Wed, 03 May 2006 10:55:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976982#M99372</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-05-03T10:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976983#M99373</link>
      <description>Not on thread topic.&lt;BR /&gt;&lt;BR /&gt;Having some trouble replying to your firewall question. Domain keeps coming up bad.&lt;BR /&gt;&lt;BR /&gt;My domain.&lt;BR /&gt;&lt;BR /&gt;Domain of sender address&lt;BR /&gt;Myemail@mydomain.com does not exist&lt;BR /&gt;&lt;BR /&gt;I've sent to you before and my MX record looks up. Perhahps provide an alternate means of me reaching you.&lt;BR /&gt;&lt;BR /&gt;Good luck with the awk, I'm too lazy today to work on it.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 03 May 2006 11:00:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976983#M99373</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-05-03T11:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976984#M99374</link>
      <description>SEP - can you go to chat?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.cmve.net/voc/voc.php" target="_blank"&gt;http://www.cmve.net/voc/voc.php&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 03 May 2006 11:04:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976984#M99374</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-05-03T11:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976985#M99375</link>
      <description>Geoff,&lt;BR /&gt;&lt;BR /&gt;This will give you what you want in the required format as well.&lt;BR /&gt;&lt;BR /&gt;lsbks -a -l $i | egrep -i 'username|user class|password valid until|type of password generator' | \&lt;BR /&gt;awk -F: 'BEGIN {print "Host Group Userid User Class Password Expires Password Generator"} {a=$2;b=$3;getline;c=$2;getline;e=$2;getline;d=$2;print a,b,c,d,e}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ninad</description>
      <pubDate>Wed, 03 May 2006 11:07:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976985#M99375</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-05-03T11:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976986#M99376</link>
      <description>Ninad - nope - format is not right...&lt;BR /&gt;&lt;BR /&gt;# lsbks -a -l DS_UNIX_SERVERS:gwild | egrep -i 'username|user class|password valid until|type of password generator' |&lt;BR /&gt;awk -F: 'BEGIN {print "Host Group Userid User Class Password Expires Password Generator"} {a=$2;b=$3;getline;c=$2;getline;e=$2;getline;d=$2;print a,b,c,d,e}'&amp;gt; awk -F: 'BEGIN {print "Host Group Userid User Class Password Expires Password Generator"} {a=$2;b=$3;getline;c=$2;getline;e=$2;getline;d=$2;print a,b,c,d,e}'&lt;BR /&gt;Host Group Userid User Class Password Expires Password Generator&lt;BR /&gt;                              DS_UNIX_SERVERS gwild                             DS_UNIX_ADMIN                   04/22/07             SecurId&lt;BR /&gt;Keon&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I included a txt file so you can see the formatting...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 03 May 2006 11:17:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976986#M99376</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-05-03T11:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976987#M99377</link>
      <description>Mike - yours seems to bail as well:&lt;BR /&gt;&lt;BR /&gt;# lsbks -a -l DS_UNIX_SERVERS:gwild |awk 'BEGIN{print "Host Group Userid User Class Password Expires Password Generator"} {a=$2;b=$3;getline;c=$2;getline;e=$2;getline;d=$2;print a,b,c,d,e}' &lt;BR /&gt;&lt;BR /&gt;Host Group Userid User Class Password Expires Password Generator&lt;BR /&gt;DS_UNIX_SERVERS:gwild  ID: ID: Class:&lt;BR /&gt;Geoffrey Wild directory: permission /bin/ksh&lt;BR /&gt;Search Path: Program: dependent timeout:&lt;BR /&gt;timeout checking: (hard) of number&lt;BR /&gt;last changed: valid login: valid&lt;BR /&gt;logout: 05/02/06 of  blocked:&lt;BR /&gt;</description>
      <pubDate>Wed, 03 May 2006 11:20:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976987#M99377</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-05-03T11:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976988#M99378</link>
      <description>Geoff,&lt;BR /&gt;&lt;BR /&gt;OK, the tab had probably not come in the previous post. Just a bit of modification. add the tr at the end, so final command would be &lt;BR /&gt;&lt;BR /&gt;lsbks -a -l $i | egrep -i 'username|user class|password valid until|type of password generator' | awk -F: 'BEGIN {print "Host Group Userid User Class Password Expires Password Generator"} {a=$2;b=$3;getline;c=$2;getline;e=$2;getline;d=$2;print a,b,c,d,e}' | tr -s "       " " "&lt;BR /&gt;&lt;BR /&gt;Note the tab between the first " quotes in tr and space in the second " quotes.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ninad</description>
      <pubDate>Wed, 03 May 2006 11:26:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976988#M99378</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-05-03T11:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976989#M99379</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;give that a try:&lt;BR /&gt;&lt;BR /&gt;... | awk 'BEGIN {print "Host ..."}&lt;BR /&gt;/^Username: / { for (i=1;i&lt;U&gt;u=0&lt;BR /&gt;split($2,us,":"); dat[++u]=us[1]; dat[++u]=us[2]&lt;BR /&gt;}&lt;BR /&gt;/^User Class:/ {dat[++u]=$3}&lt;BR /&gt;...&lt;BR /&gt;MORE MATCHES TO FILL dat-array&lt;BR /&gt;...&lt;BR /&gt;END {for (i=1;i&lt;U&gt;&lt;BR /&gt;mfG Peter&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/U&gt;</description>
      <pubDate>Wed, 03 May 2006 11:34:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976989#M99379</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-05-03T11:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976990#M99380</link>
      <description>I don't like relying on hardcoded order.&lt;BR /&gt;Here is a solution which look for each line.&lt;BR /&gt;&lt;BR /&gt;awk -F: '{gsub (/ |\t/,"",$0)} /name:/{h=$2;u=$3} /lass:/{c=$2} /tor:/{t=$2} /wordva/{v=$2} /failed/{print h,u,c,v,t}'&lt;BR /&gt;&lt;BR /&gt;- split input on ":"&lt;BR /&gt;- replace all tabs and spaces with nothing&lt;BR /&gt;- look for unique strings to identify lines&lt;BR /&gt;- for each desired line remember the value in variable&lt;BR /&gt;- Print all variables at known last line &lt;BR /&gt;(I picked 'failed', could double-up by picking 'Passwordvalid')&lt;BR /&gt;- Set OFS as desired (comma? tab?)&lt;BR /&gt;&lt;BR /&gt;Hein. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 03 May 2006 11:41:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976990#M99380</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-05-03T11:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976991#M99381</link>
      <description>Looks like Peter's is the best - thanks all...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Wed, 03 May 2006 11:54:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976991#M99381</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-05-03T11:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976992#M99382</link>
      <description>No joy on chat.&lt;BR /&gt;&lt;BR /&gt;Here is my reply to your query. &lt;BR /&gt;&lt;BR /&gt;I've considered doing it for a long time.&lt;BR /&gt;&lt;BR /&gt;NDS did it on a project for me a few months ago to stop script kiddies&lt;BR /&gt;auto login attempts.&lt;BR /&gt;&lt;BR /&gt;It worked nicely&lt;BR /&gt;&lt;BR /&gt;If I had it to do in iptables, your way is how I'd do it.&lt;BR /&gt;&lt;BR /&gt;iptables -D INPUT -m tcp -p tcp --dport 22 -j DROP&lt;BR /&gt;# were my default now dropping&lt;BR /&gt;iptables -A INPUT -m tcp -p tcp --dport 22 --source $IPRANGE1 -j ACCEPT&lt;BR /&gt;iptables -A INPUT -m tcp -p tcp --dport 22 --source $IPRANGE2 -j ACCEPT&lt;BR /&gt;iptables -A INPUT -m tcp -p tcp --dport 22 --source $IPRANGE3 -j ACCEPT #&lt;BR /&gt;we now have a range perhaps covering office and home.&lt;BR /&gt;&lt;BR /&gt;iptables -A INPUT -m tcp -p tcp --dport 22 -j DROP&lt;BR /&gt;# Redundant, I think this last line should be dropped.&lt;BR /&gt;&lt;BR /&gt;Make sure your range covers a fixed address where you always have access.&lt;BR /&gt;I have a Shell account at speakeasy, so I make sure that server is covered&lt;BR /&gt;by an accept range. Then no matter where I am, I access speakeasy and I'm&lt;BR /&gt;in. Problem came up when speakeasy changed the network server address and&lt;BR /&gt;didn't tell me. Naturally this happened when I was sitting in an airport&lt;BR /&gt;waiting for a flight and needed to diagnose a problem.&lt;BR /&gt;&lt;BR /&gt;Another thing to think about:&lt;BR /&gt;FC-5 has clustering built in. Even on a single node server, you can start&lt;BR /&gt;services with clustering instead of chkconfig and you get a built in&lt;BR /&gt;service monitor.&lt;BR /&gt;&lt;BR /&gt;Have fun.&lt;BR /&gt;&lt;BR /&gt;Interesting thread here.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 03 May 2006 11:59:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976992#M99382</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-05-03T11:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976993#M99383</link>
      <description>SEP - yes - I put my way into production - works great.&lt;BR /&gt;&lt;BR /&gt;As far as your email - my maillog is huge!&lt;BR /&gt;&lt;BR /&gt;I'm at work and can't remember you email addy  :(&lt;BR /&gt;&lt;BR /&gt;Chat doesn't work for you eh?  too bad...&lt;BR /&gt;&lt;BR /&gt;I'll check when I'm at home tonight...</description>
      <pubDate>Wed, 03 May 2006 12:05:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976993#M99383</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-05-03T12:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976994#M99384</link>
      <description>As far as this thread - I'm thinking I'm using the wrong tool - should be perl.....&lt;BR /&gt;&lt;BR /&gt;What I have now:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;#print a header&lt;BR /&gt;printf "Host Group \tUserid\tUser Class\tType\tPW Valid\tBlocked"&lt;BR /&gt;&lt;BR /&gt;#get a list of id's&lt;BR /&gt;for i in `/opt/boksm/sbin/lsbks -a -l *:* -Dl`&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;  lsbks -a -l $i | \&lt;BR /&gt;  awk 'BEGIN {}&lt;BR /&gt;  /^Username: / { for (i=1;i&lt;U&gt;  u=0&lt;BR /&gt;  split($2,us,":"); dat[++u]=us[1]; dat[++u]=us[2]&lt;BR /&gt;  }&lt;BR /&gt;  /^User Class:/ {dat[++u]=$3}&lt;BR /&gt;  /^Type of password generator:/ {dat[++u]=$5}&lt;BR /&gt;  /^Password valid until:/ {dat[++u]=$4}&lt;BR /&gt;  /^User blocked:/ {dat[++u]=$3}&lt;BR /&gt;  END {for (i=1;i&lt;U&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Output is still kind of ugly, for is the user isn't on Securid, nothing for that field..&lt;BR /&gt;&lt;BR /&gt;Sample output in attachment...&lt;BR /&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/U&gt;</description>
      <pubDate>Wed, 03 May 2006 12:15:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976994#M99384</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-05-03T12:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Awk Programming help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976995#M99385</link>
      <description>Here is a 'cute' perl approach.&lt;BR /&gt;&lt;BR /&gt;All the words before the first colon become key to a data array, the value being the second field.&lt;BR /&gt;&lt;BR /&gt;An execption is made for 'username', having a double value.&lt;BR /&gt;&lt;BR /&gt;When the 'last' key is seen we&lt;BR /&gt;- deal with non-existing values as needed&lt;BR /&gt;- printf using the same format used to print the header, and just naming whatever fields desired&lt;BR /&gt;- clear the data array for the next round&lt;BR /&gt;&lt;BR /&gt;------------ pretty.pl -----&lt;BR /&gt;&lt;BR /&gt;$format="%20s %20s %20s %10s %10s %10s\n";&lt;BR /&gt;printf $format, "Host Group","Userid","User Class","PW Valid", "Type", "Blocked";&lt;BR /&gt;&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;s/\s+//g;&lt;BR /&gt;($key,$value,$extra)=split /:/;&lt;BR /&gt;$a{$key}=$value;&lt;BR /&gt;$a{name}=$extra if /^Username/;&lt;BR /&gt;if (/blocked/) {&lt;BR /&gt;    $a{Typeofpasswordgenerator} = "NA" unless $a{Typeofpasswordgenerator};&lt;BR /&gt;    printf $format, $a{Username}, $a{name}, $a{UserClass},&lt;BR /&gt;       $a{Passwordvaliduntil}, $a{Typeofpasswordgenerator}, $a{Userblocked};&lt;BR /&gt;    undef (%a);&lt;BR /&gt;    }&lt;BR /&gt;}</description>
      <pubDate>Wed, 03 May 2006 13:05:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-programming-help/m-p/4976995#M99385</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-05-03T13:05:34Z</dc:date>
    </item>
  </channel>
</rss>

