<?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: bust up a variable in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928343#M719935</link>
    <description>just using the shell:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;fname=&lt;BR /&gt;lname=&lt;BR /&gt;&lt;BR /&gt;function modname {&lt;BR /&gt;&lt;BR /&gt;typeset -u fchar&lt;BR /&gt;typeset -l rest&lt;BR /&gt;&lt;BR /&gt;fchar=$(print $1 | cut -c 1)&lt;BR /&gt;rest=$(print $1 | cut -c 2-)&lt;BR /&gt;&lt;BR /&gt;print "${fchar}$rest"&lt;BR /&gt;return&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;fname=$(modname $fname)&lt;BR /&gt;len=${#fname}&lt;BR /&gt;if [ $len &amp;gt; 7 ] ;then&lt;BR /&gt;fname=$(print $fname | cut -c 1-7)&lt;BR /&gt;fi&lt;BR /&gt;lname=$(modname $lname)&lt;BR /&gt;name="${fname}$lname"&lt;BR /&gt;len=${#name}&lt;BR /&gt;if [ $len &amp;gt; 8 ] ;then&lt;BR /&gt;name=$(print $name | cut -c 1-8)&lt;BR /&gt;print $name&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Sun, 16 Mar 2003 17:02:53 GMT</pubDate>
    <dc:creator>curt larson_1</dc:creator>
    <dc:date>2003-03-16T17:02:53Z</dc:date>
    <item>
      <title>bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928337#M719929</link>
      <description>this might be easy to do for most, but I am having a mental block with it.&lt;BR /&gt;&lt;BR /&gt;I have a variable that contains all-capps of a persons last name.&lt;BR /&gt;&lt;BR /&gt;1. how do i break up the variable into variables that only contain the characters?&lt;BR /&gt;&lt;BR /&gt;2. how do I change from caps to lowercase?&lt;BR /&gt;&lt;BR /&gt;3. how do i capitalize the 1st character?&lt;BR /&gt;&lt;BR /&gt;4. also need to comply to creating userid's from these names, where the uid must be the first 7 characters of the last name and the 1st let of the first name.&lt;BR /&gt;&lt;BR /&gt;5. also some last names are less than 7 characters, in that case more charaters must be used from the first name to make up 8 characters.&lt;BR /&gt;&lt;BR /&gt;in ksh please.&lt;BR /&gt;&lt;BR /&gt;I have 300 user accounts to create and they provided me with lastnames in caps in first names in lowercase.&lt;BR /&gt;&lt;BR /&gt;Donny&lt;BR /&gt;</description>
      <pubDate>Sun, 16 Mar 2003 13:55:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928337#M719929</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-03-16T13:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928338#M719930</link>
      <description>Case sensitivity:&lt;BR /&gt;&lt;BR /&gt;typeset -u VAR=abc&lt;BR /&gt;echo $VAR &lt;BR /&gt;ABC&lt;BR /&gt;&lt;BR /&gt;typeset -l VAR=ABC&lt;BR /&gt;echo $VAR&lt;BR /&gt;abc&lt;BR /&gt;&lt;BR /&gt;For putlling char's out of a string:&lt;BR /&gt;&lt;BR /&gt;FOURTH=$(echo $VAR | cut -c 4)&lt;BR /&gt;&lt;BR /&gt;TWO=$(echo $VAR | cut -c 2)&lt;BR /&gt;&lt;BR /&gt;etc.&lt;BR /&gt;&lt;BR /&gt;For question #5, about 7 or 8 chars.&lt;BR /&gt;&lt;BR /&gt;Build your EIGHT VAR's and manipulate them anyway you want.&lt;BR /&gt;&lt;BR /&gt;ONE&lt;BR /&gt;TWO&lt;BR /&gt;...&lt;BR /&gt;SEVEN = NULL?&lt;BR /&gt;EIGHT = NULL?&lt;BR /&gt;&lt;BR /&gt;etc.&lt;BR /&gt;&lt;BR /&gt;Get a copy of "The New Kornshell Command Reference " by Bolsky and Korn.</description>
      <pubDate>Sun, 16 Mar 2003 14:28:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928338#M719930</guid>
      <dc:creator>Michael Steele_2</dc:creator>
      <dc:date>2003-03-16T14:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928339#M719931</link>
      <description>if I understand you correctly then, if I already have a variable with information in it and I know its CAPS, then:&lt;BR /&gt;&lt;BR /&gt;LASTNAME=ANDERSON&lt;BR /&gt;typeset -l $LASTNAME&lt;BR /&gt;echo $LASTNAME&lt;BR /&gt;anderson&lt;BR /&gt;&lt;BR /&gt;or did I loose it all together.</description>
      <pubDate>Sun, 16 Mar 2003 15:29:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928339#M719931</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-03-16T15:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928340#M719932</link>
      <description>To set all the last names to lower case you could also use the tr utility.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; LASTNAME=DONOVAN&lt;BR /&gt;&amp;gt; echo $LASTNAME| tr "[:upper:]" "[:lower:]"&lt;BR /&gt;&amp;gt; donovan&lt;BR /&gt;&lt;BR /&gt;and if your new user's names are ina single file then you can use tr as follows:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; cat filename|tr "[:upper:]" "[:lower:]" &amp;gt;lowercase&lt;BR /&gt;&lt;BR /&gt;and all uppercase in "filename" will be translated to lowercase in "lowercase"&lt;BR /&gt;&lt;BR /&gt;...it would be &lt;BR /&gt;typset -l LASTNAME=ANDERSON&lt;BR /&gt;echo $LASTNAME&lt;BR /&gt;anderson&lt;BR /&gt;&lt;BR /&gt;Rule #5 seems contrived to me.  What happens when you eventually have a user whose first and last names combined do not total 8 characters?</description>
      <pubDate>Sun, 16 Mar 2003 16:02:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928340#M719932</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2003-03-16T16:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928341#M719933</link>
      <description>here is a quick awk script,&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;fname=&lt;BR /&gt;lname=&lt;BR /&gt;&lt;BR /&gt;print "$fname $lname" | awk '&lt;BR /&gt;function modname(string) {&lt;BR /&gt;len=length(string);&lt;BR /&gt;if (len&amp;gt;7) len=6;&lt;BR /&gt;fchar=toupper(substr(string,1,1));&lt;BR /&gt;rest=tolower(substr(string,2,len));&lt;BR /&gt;return fchar rest&lt;BR /&gt;}&lt;BR /&gt;{&lt;BR /&gt;name=modname($1) modname($2);&lt;BR /&gt;len=length(name);&lt;BR /&gt;if (len&amp;gt;7) name=substr(name,1,8);&lt;BR /&gt;print name;&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Sun, 16 Mar 2003 16:23:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928341#M719933</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-03-16T16:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928342#M719934</link>
      <description>Jim,&lt;BR /&gt;&lt;BR /&gt;thanx for your tutorial&lt;BR /&gt;&lt;BR /&gt;as for #5,&lt;BR /&gt;I think, one would want to use all the users last name, and oh, now I remember.&lt;BR /&gt;&lt;BR /&gt;you start using charaters in the users first name.&lt;BR /&gt;&lt;BR /&gt;and I guess, if the users last and first name combined is less than 8, they want it to be populated with something unique&lt;BR /&gt;&lt;BR /&gt;interresting ....</description>
      <pubDate>Sun, 16 Mar 2003 16:56:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928342#M719934</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-03-16T16:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928343#M719935</link>
      <description>just using the shell:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;fname=&lt;BR /&gt;lname=&lt;BR /&gt;&lt;BR /&gt;function modname {&lt;BR /&gt;&lt;BR /&gt;typeset -u fchar&lt;BR /&gt;typeset -l rest&lt;BR /&gt;&lt;BR /&gt;fchar=$(print $1 | cut -c 1)&lt;BR /&gt;rest=$(print $1 | cut -c 2-)&lt;BR /&gt;&lt;BR /&gt;print "${fchar}$rest"&lt;BR /&gt;return&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;fname=$(modname $fname)&lt;BR /&gt;len=${#fname}&lt;BR /&gt;if [ $len &amp;gt; 7 ] ;then&lt;BR /&gt;fname=$(print $fname | cut -c 1-7)&lt;BR /&gt;fi&lt;BR /&gt;lname=$(modname $lname)&lt;BR /&gt;name="${fname}$lname"&lt;BR /&gt;len=${#name}&lt;BR /&gt;if [ $len &amp;gt; 8 ] ;then&lt;BR /&gt;name=$(print $name | cut -c 1-8)&lt;BR /&gt;print $name&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 16 Mar 2003 17:02:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928343#M719935</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-03-16T17:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928344#M719936</link>
      <description>jim &amp;amp; curt,&lt;BR /&gt;&lt;BR /&gt;thanx, a million. I am ok from here on. will send you the final script for critique&lt;BR /&gt;&lt;BR /&gt;10 point for both.</description>
      <pubDate>Sun, 16 Mar 2003 17:13:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928344#M719936</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-03-16T17:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928345#M719937</link>
      <description>to add some characters to the end:&lt;BR /&gt;&lt;BR /&gt;elif [ $len &amp;lt; 8 ] ;then&lt;BR /&gt;&lt;BR /&gt;set -A Chars a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 . /&lt;BR /&gt;&lt;BR /&gt;while [ $len &amp;lt; 8 ]&lt;BR /&gt;do&lt;BR /&gt;num=$(($RANDOM / 512 ))&lt;BR /&gt;char=${Chars[$num]}&lt;BR /&gt;name="${name}$char"&lt;BR /&gt;len=${#name}&lt;BR /&gt;done</description>
      <pubDate>Sun, 16 Mar 2003 17:26:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928345#M719937</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-03-16T17:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: bust up a variable</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928346#M719938</link>
      <description>great, this is turning out to be a killer script.</description>
      <pubDate>Sun, 16 Mar 2003 17:34:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/bust-up-a-variable/m-p/2928346#M719938</guid>
      <dc:creator>Donny Jekels</dc:creator>
      <dc:date>2003-03-16T17:34:31Z</dc:date>
    </item>
  </channel>
</rss>

