<?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 help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081101#M142671</link>
    <description>oops really should be a while loop in that last suggestion:&lt;BR /&gt;&lt;BR /&gt;cat tmp/users.dat | tr ":" " " |&lt;BR /&gt;while read USER UID GROUP DIR SHELL COMMENTS&lt;BR /&gt;do&lt;BR /&gt;print $USER&lt;BR /&gt;print "$COMMENTS"&lt;BR /&gt;# etc&lt;BR /&gt;done&lt;BR /&gt;</description>
    <pubDate>Mon, 29 Sep 2003 16:18:27 GMT</pubDate>
    <dc:creator>curt larson_1</dc:creator>
    <dc:date>2003-09-29T16:18:27Z</dc:date>
    <item>
      <title>awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081097#M142667</link>
      <description>for i in `cat /tmp/users.dat`&lt;BR /&gt;do&lt;BR /&gt;USER=`echo $i | awk -F":" '{print $1}'`&lt;BR /&gt;UID=`echo $i | awk -F":" '{print $2}'`&lt;BR /&gt;GROUP=`echo $i | awk -F":" '{print $3}'`&lt;BR /&gt;DIR=`echo $i | awk -F":" '{print $4}'`&lt;BR /&gt;SHELL=`echo $i | awk -F":" '{print $5}'`&lt;BR /&gt;COMMENTS=`echo $i | awk -F":" '{print $6}'`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The sample of the line in t/mp/users.dat is following:&lt;BR /&gt;user:uid:group:dir:shell:firstname lastname,location,phone,&lt;BR /&gt;&lt;BR /&gt;My question is: how can I assign the rest portion of the line&lt;BR /&gt;after"shell:" to $6?&lt;BR /&gt;The current script only assign "firstname" to $6, and it cuts off the portion of &lt;BR /&gt;" lastname,location,phone,".&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;</description>
      <pubDate>Mon, 29 Sep 2003 15:56:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081097#M142667</guid>
      <dc:creator>Hanry Zhou</dc:creator>
      <dc:date>2003-09-29T15:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081098#M142668</link>
      <description>just testing&lt;BR /&gt;no points</description>
      <pubDate>Mon, 29 Sep 2003 16:06:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081098#M142668</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-09-29T16:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081099#M142669</link>
      <description>an different way would be&lt;BR /&gt;&lt;BR /&gt;oldIFS="$IFS"&lt;BR /&gt;IFS=":"&lt;BR /&gt;&lt;BR /&gt;cat /tmp/users.dat |&lt;BR /&gt;while read USER UID GROUP DIR SHELL REST&lt;BR /&gt;do&lt;BR /&gt;print $USER&lt;BR /&gt;print $REST&lt;BR /&gt;#etc&lt;BR /&gt;done&lt;BR /&gt;IFS="$oldIFS"&lt;BR /&gt;&lt;BR /&gt;sorry for the test, but I hadn't been able to reply for a month or so</description>
      <pubDate>Mon, 29 Sep 2003 16:10:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081099#M142669</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-09-29T16:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081100#M142670</link>
      <description>another way&lt;BR /&gt;&lt;BR /&gt;only works if ":" is only used as field seperator&lt;BR /&gt;&lt;BR /&gt;cat tmp/users.dat | tr ":" " " |&lt;BR /&gt;read USER UID GROUP DIR SHELL COMMENTS&lt;BR /&gt;print $USER&lt;BR /&gt;print "$COMMENTS"&lt;BR /&gt;&lt;BR /&gt;if there are extra fields read will place them all in the last variable name</description>
      <pubDate>Mon, 29 Sep 2003 16:16:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081100#M142670</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-09-29T16:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081101#M142671</link>
      <description>oops really should be a while loop in that last suggestion:&lt;BR /&gt;&lt;BR /&gt;cat tmp/users.dat | tr ":" " " |&lt;BR /&gt;while read USER UID GROUP DIR SHELL COMMENTS&lt;BR /&gt;do&lt;BR /&gt;print $USER&lt;BR /&gt;print "$COMMENTS"&lt;BR /&gt;# etc&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Mon, 29 Sep 2003 16:18:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081101#M142671</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-09-29T16:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081102#M142672</link>
      <description>Here is one approach:&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;FNAME=/tmp/users.dat&lt;BR /&gt;cat ${FNAME} | while read i&lt;BR /&gt;do&lt;BR /&gt;USER=$(echo ${i} | awk -F":" '{print $1}')&lt;BR /&gt;UID=$(echo ${i} | awk -F":" '{print $2}')&lt;BR /&gt;GROUP=$(echo ${i} | awk -F":" '{print $3}')&lt;BR /&gt;DIR=$(echo ${i} | awk -F":" '{print $4}')&lt;BR /&gt;SHELL=$(echo ${i} | awk -F":" '{print $5}')&lt;BR /&gt;COMMENTS=$(echo ${i} | awk -F":" '{print $6}')&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Mon, 29 Sep 2003 16:22:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081102#M142672</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-09-29T16:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081103#M142673</link>
      <description>could always do it this way&lt;BR /&gt;&lt;BR /&gt;COMMENTS=`echo $i | cut -d":" -f6</description>
      <pubDate>Mon, 29 Sep 2003 16:24:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081103#M142673</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-09-29T16:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081104#M142674</link>
      <description>or as&lt;BR /&gt;&lt;BR /&gt;cat /tmp/users.dat |&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;comment=${line##*:}&lt;BR /&gt;done</description>
      <pubDate>Mon, 29 Sep 2003 16:29:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081104#M142674</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-09-29T16:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081105#M142675</link>
      <description>Curt,&lt;BR /&gt;&lt;BR /&gt;Thanks for your messages,&lt;BR /&gt;&lt;BR /&gt;Could you please explore this a little bit more:&lt;BR /&gt;comment=${line##*:}&lt;BR /&gt;&lt;BR /&gt;Points will be followed.</description>
      <pubDate>Wed, 01 Oct 2003 12:43:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081105#M142675</guid>
      <dc:creator>Hanry Zhou</dc:creator>
      <dc:date>2003-10-01T12:43:43Z</dc:date>
    </item>
    <item>
      <title>Re: awk help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081106#M142676</link>
      <description>It means 'comment equals everything after the last colon in the line'</description>
      <pubDate>Wed, 01 Oct 2003 12:54:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-help/m-p/3081106#M142676</guid>
      <dc:creator>Vitek Pepas</dc:creator>
      <dc:date>2003-10-01T12:54:37Z</dc:date>
    </item>
  </channel>
</rss>

