<?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: Scripting help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349533#M192222</link>
    <description>Sean -- This has less error checking then you're original script, but here you go:&lt;BR /&gt;&lt;BR /&gt;awk '{FS=":"; u5=$5; p2=$1; $0=u5; FS=","; print $4","p2","$5;}' passwd&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Essentially we are printing the fourth part of the fifth field then a comma then the first field then the fifth part of the fifth field.&lt;BR /&gt;&lt;BR /&gt;Hope that helps.&lt;BR /&gt;&lt;BR /&gt;Oz&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 04 Aug 2004 13:30:18 GMT</pubDate>
    <dc:creator>Kent Ostby</dc:creator>
    <dc:date>2004-08-04T13:30:18Z</dc:date>
    <item>
      <title>Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349525#M192214</link>
      <description>Can anyone rewrite this script snippet so that it will be more efficient?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;for PWDRECORD in `cat '/etc/passwd'`&lt;BR /&gt;do&lt;BR /&gt;  LOG_ID=`echo $PWDRECORD|cut -d':' -f1`&lt;BR /&gt;  COSMO_ID=`echo $PWDRECORD|cut -d',' -f4`&lt;BR /&gt;  if [ "$LOG_ID" = "" -o "$COSMO_ID" = "" ]&lt;BR /&gt;  then&lt;BR /&gt;    continue&lt;BR /&gt;  fi&lt;BR /&gt;  if [ `echo "$COSMO_ID" | grep ":" &amp;gt; /dev/null` ]&lt;BR /&gt;  then&lt;BR /&gt;    continue&lt;BR /&gt;  fi&lt;BR /&gt;  STUDENT_EMPLOYEE=`echo $PWDRECORD|cut -d ',' -f5`&lt;BR /&gt;  STUDENT_EMPLOYEE=`echo $STUDENT_EMPLOYEE | cut -c1`&lt;BR /&gt;  ( echo $COSMO_ID | grep $LOG_ID &amp;gt;/dev/null )|| ( [ ! "$COSMO_ID" = "0" ] &amp;amp;&amp;amp; \&lt;BR /&gt;    echo $COSMO_ID","$LOG_ID","$STUDENT_EMPLOYEE &amp;gt;&amp;gt; /tmp/bbids.list )&lt;BR /&gt;  unset LOG_ID&lt;BR /&gt;  unset COSMO_ID&lt;BR /&gt;  unset STUDENT_EMPLOYEE&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TIA and points for all responses.&lt;BR /&gt;&lt;BR /&gt;Sean&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 11:23:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349525#M192214</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2004-08-04T11:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349526#M192215</link>
      <description>No idea if I got your logic right... :-) however, this should be *much* faster. A pure perl or awk solution could be a lot more fast, of course.&lt;BR /&gt; &lt;BR /&gt;while IFS=: read LOG_ID x x x FIELD5 x&lt;BR /&gt;do&lt;BR /&gt;  typeset -L1 STUDENT_EMPLOYEE&lt;BR /&gt;  echo $FIELD5 | IFS=, read x x x COSMO_ID STUDENT_EMPLOYEE x&lt;BR /&gt;  [[ -z "$LOG_ID" || -z "$COSMO_ID" || "$COSMO_ID" = *:* ]] &amp;amp;&amp;amp; continue&lt;BR /&gt;  [[ ! $COSMO_ID = *$LOG_ID* &amp;amp;&amp;amp; ! "$COSMO_ID" = "0" ]] &amp;amp;&amp;amp;  echo "$COSMO_ID,$LOG_ID,$STUDENT_EMPLOYEE"&lt;BR /&gt;  unset COSMO_ID&lt;BR /&gt;  unset STUDENT_EMPLOYEE&lt;BR /&gt;  unset STUDENT_EMPLOYEE&lt;BR /&gt;done &amp;lt; passwd&lt;BR /&gt; &lt;BR /&gt;Best regards...&lt;BR /&gt;Dietmar.</description>
      <pubDate>Wed, 04 Aug 2004 12:37:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349526#M192215</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2004-08-04T12:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349527#M192216</link>
      <description>Sean -- can you give me a sample input and output lines.&lt;BR /&gt;&lt;BR /&gt;If so, I can write an awk script that should be fairly clean for this.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Kent M. Ostby&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 13:08:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349527#M192216</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-08-04T13:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349528#M192217</link>
      <description>cat /etc/passwd |&lt;BR /&gt;awk -F":" '{&lt;BR /&gt;logId=$1;&lt;BR /&gt;l1=length(logId);&lt;BR /&gt;# if logId = "" do next record&lt;BR /&gt;if ( l1 == 0 ) next;&lt;BR /&gt;gecos=$5;&lt;BR /&gt;split(gecos,a,",");&lt;BR /&gt;cosmoId=a[4];&lt;BR /&gt;l1=length(cosmoId);&lt;BR /&gt;if ( l1 == 0 ) next;&lt;BR /&gt;if ( cosmoId ~ ":" ) next;&lt;BR /&gt;stdEmp=substr(a[5],1,1);&lt;BR /&gt;if ( cosmoId !~ logId &amp;amp;&amp;amp; cosmoId != "0" )&lt;BR /&gt;print cosmoId,logId,stdEmp;&lt;BR /&gt;}' &amp;gt;/tmp/bbids.list&lt;BR /&gt;&lt;BR /&gt;that is a good start on an awk script&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 13:15:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349528#M192217</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-08-04T13:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349529#M192218</link>
      <description>Thanks, testing it now to see if it comes out with the same results as the original.&lt;BR /&gt;&lt;BR /&gt;Can you take a minute to explain to me what this is doing?  I mean your script and how it works.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 13:17:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349529#M192218</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2004-08-04T13:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349530#M192219</link>
      <description>Sorry that reply was meant for Dietmar.&lt;BR /&gt;&lt;BR /&gt;Kent, here's sample input: &lt;BR /&gt;&lt;BR /&gt;aaronk:x:43280:20:Aaron,Karema,D,0296002,S:/false/home:/bin/false&lt;BR /&gt;&lt;BR /&gt;and output:&lt;BR /&gt;&lt;BR /&gt;0296002,aaronk,S&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 13:20:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349530#M192219</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2004-08-04T13:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349531#M192220</link>
      <description>Curt, &lt;BR /&gt;&lt;BR /&gt;That's pretty close except that it is putting spaces instead of commas between the entries.  I stuck in commas, but it still puts in the spaces.  Is there a way to suppress the spaces?</description>
      <pubDate>Wed, 04 Aug 2004 13:25:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349531#M192220</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2004-08-04T13:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349532#M192221</link>
      <description>Curt,&lt;BR /&gt;&lt;BR /&gt;hmm, not quite right, even after I stripped out the spaces manually:&lt;BR /&gt;&lt;BR /&gt;bbids.list is the orig, bbids.lst2 is from your script:&lt;BR /&gt;&lt;BR /&gt;root@cosmo0:/tmp/sean-&amp;gt; diff bbids.list bbids.lst2&lt;BR /&gt;1c1&lt;BR /&gt;&amp;lt; 9123456,aaaaaaaa,S&lt;BR /&gt;---&lt;BR /&gt;&amp;gt; 9.12346e+06,aaaaaaaa,S&lt;BR /&gt;267c267&lt;BR /&gt;&amp;lt; 8675309,acme001,S&lt;BR /&gt;---&lt;BR /&gt;&amp;gt; 8.67531e+06,acme001,S&lt;BR /&gt;2869c2869&lt;BR /&gt;&amp;lt; EXM20031026023108.CSV:0924004,ashleyt,E&lt;BR /&gt;---&lt;BR /&gt;&amp;gt; EXM20031026023108.CSV,ashleyt,&lt;BR /&gt;20019c20019&lt;BR /&gt;&amp;lt; 8888888,doofusj,E&lt;BR /&gt;---&lt;BR /&gt;&amp;gt; 8.88889e+06,doofusj,E&lt;BR /&gt;68532c68532&lt;BR /&gt;&amp;lt; 9876543,ptest,E&lt;BR /&gt;---&lt;BR /&gt;&amp;gt; 9.87654e+06,ptest,E&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here are the original entries for those records.&lt;BR /&gt;&lt;BR /&gt;doofusj:x:72495:20:Doofus,Joe,P,8888888,E:/home/doofusj:/usr/local/matc/bin/cosmo&lt;BR /&gt;ptest:x:99910:20:Fanning,Pete,W,9876543,E:/home/ptest:/usr/local/matc/bin/cosmo&lt;BR /&gt;ashleyt:x:38154:20:Ashley,Terry,,EXM20031026023108.CSV:0924004,E:/home/ashleyt:/usr/local/matc/bin/cosmo&lt;BR /&gt;acme001:x:50000:20:Neumann,Alfred,E,8675309,S:/false/home:/bin/false&lt;BR /&gt;aaaaaaaa:x:1909:20:TestLast,TestFirst,M,9123456,S:/false/home:/bin/false&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 13:29:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349532#M192221</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2004-08-04T13:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349533#M192222</link>
      <description>Sean -- This has less error checking then you're original script, but here you go:&lt;BR /&gt;&lt;BR /&gt;awk '{FS=":"; u5=$5; p2=$1; $0=u5; FS=","; print $4","p2","$5;}' passwd&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Essentially we are printing the fourth part of the fifth field then a comma then the first field then the fifth part of the fifth field.&lt;BR /&gt;&lt;BR /&gt;Hope that helps.&lt;BR /&gt;&lt;BR /&gt;Oz&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 13:30:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349533#M192222</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-08-04T13:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349534#M192223</link>
      <description>a couple of improvements&lt;BR /&gt;&lt;BR /&gt;cat /etc/passwd |&lt;BR /&gt;awk -F":" '{&lt;BR /&gt;logId=$1;&lt;BR /&gt;# if logId = "" do next record&lt;BR /&gt;if ( ! logId ) next;&lt;BR /&gt;gecos=$5;&lt;BR /&gt;split(gecos,a,",");&lt;BR /&gt;cosmoId=a[4];&lt;BR /&gt;if ( ! cosmoId ) next;&lt;BR /&gt;stdEmp=substr(a[5],1,1);&lt;BR /&gt;if ( cosmoId !~ logId &amp;amp;&amp;amp; cosmoId != "0" )&lt;BR /&gt;print cosmoId,logId,stdEmp;&lt;BR /&gt;}' &amp;gt;/tmp/bbids.list&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 13:36:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349534#M192223</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-08-04T13:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349535#M192224</link>
      <description>for the printing do&lt;BR /&gt;printf("%s,%s,%s\n",cosmoId,logId,stdEmp);&lt;BR /&gt;instead of&lt;BR /&gt;print cosmoId,logId,stdEmp;</description>
      <pubDate>Wed, 04 Aug 2004 13:39:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349535#M192224</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-08-04T13:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349536#M192225</link>
      <description>I can not exactly follow the intention of the script, but the following awk code should be pretty darn close, or at least serve as 'food for thought'. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;BEGIN {IFS=":";OFS=","}&lt;BR /&gt;{&lt;BR /&gt;LOG_ID = $1;&lt;BR /&gt;split($0,commas,",");&lt;BR /&gt;COSMO_ID=commas[3];&lt;BR /&gt;if (LOG_ID COSMO_ID == "") { next };&lt;BR /&gt;STUDENT_EMPLOYEE=substr(commas[4],1,1);&lt;BR /&gt;if (index(COSMO_ID,LOG_ID) || (COSMO_ID != 0)) {&lt;BR /&gt;   print COSMO_ID, LOG_ID, STUDENT_EMPLOYEE &amp;gt;&amp;gt; "/tmp/bbid.lst";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Aug 2004 13:43:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349536#M192225</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-08-04T13:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349537#M192226</link>
      <description>Thanks everyone.  The results are in.  The original ran for 5 hours this morning. The new script took 11 seconds.  :-)&lt;BR /&gt;&lt;BR /&gt;I knew I could count on the ITRC forum crew!</description>
      <pubDate>Wed, 04 Aug 2004 14:08:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-help/m-p/3349537#M192226</guid>
      <dc:creator>Sean OB_1</dc:creator>
      <dc:date>2004-08-04T14:08:39Z</dc:date>
    </item>
  </channel>
</rss>

