<?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: please help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help/m-p/2577572#M858926</link>
    <description>1 - to grep data_1 &amp;amp; not get data_1_th use&lt;BR /&gt;&lt;BR /&gt;grep ^data_1: &lt;FILE&gt;&lt;BR /&gt;&lt;BR /&gt;2 - to write you a script I would use awk&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;file=group-file&lt;BR /&gt;echo "Input user to be added ==&amp;gt;\c"&lt;BR /&gt;read user&lt;BR /&gt;echo "Input group for user to be added to ==&amp;gt;\c"&lt;BR /&gt;read group&lt;BR /&gt;&lt;BR /&gt;awk -F":" '$1==GROUP {         for (i=1; i&amp;lt;=NF; i=i+1)          printf "%s:", $i ;          printf "%s:\n", USER        }         $1!=GROUP {         for (i=1; i&amp;lt;=NF-1; i=i+1)&lt;BR /&gt;         printf "%s:", $i ;          printf "%s:\n", $NF        }         ' USER=$user GROUP=$group $file &amp;gt; $file.tmp&lt;BR /&gt;mv $file.tmp $file&lt;BR /&gt;&lt;BR /&gt;** PLEASE NOTE ** The group file you have listed above will NOT be /etc/group, as this has a totally different format.  If you do mean this file then the script needs to be modified!&lt;BR /&gt;&lt;BR /&gt;Tim&lt;/FILE&gt;</description>
    <pubDate>Tue, 11 Sep 2001 09:53:39 GMT</pubDate>
    <dc:creator>Tim D Fulford</dc:creator>
    <dc:date>2001-09-11T09:53:39Z</dc:date>
    <item>
      <title>please help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help/m-p/2577570#M858924</link>
      <description>data_1:1a:2b:3c:4d:5e:6f:7g:8h:9i:10j:&lt;BR /&gt;&lt;BR /&gt;data_1_th:11A:12B:13C:14D:15E:16F:17G:18H:19I:20J:&lt;BR /&gt;&lt;BR /&gt;assuming "data_1" and "data_1_th" is group name and 1a,2b....11A,11B...are the member of "data_1" and "data_1_th" respectively. &lt;BR /&gt;&lt;BR /&gt;What I need now is to grep the group name and once the group name was grep I need to go to the last entry of the of the particular group and place a new entry there and ends with ":". All I need now is to grep the correct group name and remember that the group is a continous data and it is not fixed! Please advise. Thanks in advance.</description>
      <pubDate>Tue, 11 Sep 2001 02:18:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help/m-p/2577570#M858924</guid>
      <dc:creator>Ken Lee_1</dc:creator>
      <dc:date>2001-09-11T02:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: please help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help/m-p/2577571#M858925</link>
      <description>Hi Ken,&lt;BR /&gt;&lt;BR /&gt;You could use sed in a script:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;sed "s/\(^$1:.*\)/\1$2:/" yourfile &amp;gt; yourfile.new&lt;BR /&gt;mv yourfile.new yourfile&lt;BR /&gt;&lt;BR /&gt;run the script using:&lt;BR /&gt;&lt;BR /&gt;yourscript.sh group new_entry&lt;BR /&gt;&lt;BR /&gt;Or are you saying that data_1 and data_1_th are related and can only have 10 entries per line?&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Tue, 11 Sep 2001 06:30:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help/m-p/2577571#M858925</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-09-11T06:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: please help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/please-help/m-p/2577572#M858926</link>
      <description>1 - to grep data_1 &amp;amp; not get data_1_th use&lt;BR /&gt;&lt;BR /&gt;grep ^data_1: &lt;FILE&gt;&lt;BR /&gt;&lt;BR /&gt;2 - to write you a script I would use awk&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;file=group-file&lt;BR /&gt;echo "Input user to be added ==&amp;gt;\c"&lt;BR /&gt;read user&lt;BR /&gt;echo "Input group for user to be added to ==&amp;gt;\c"&lt;BR /&gt;read group&lt;BR /&gt;&lt;BR /&gt;awk -F":" '$1==GROUP {         for (i=1; i&amp;lt;=NF; i=i+1)          printf "%s:", $i ;          printf "%s:\n", USER        }         $1!=GROUP {         for (i=1; i&amp;lt;=NF-1; i=i+1)&lt;BR /&gt;         printf "%s:", $i ;          printf "%s:\n", $NF        }         ' USER=$user GROUP=$group $file &amp;gt; $file.tmp&lt;BR /&gt;mv $file.tmp $file&lt;BR /&gt;&lt;BR /&gt;** PLEASE NOTE ** The group file you have listed above will NOT be /etc/group, as this has a totally different format.  If you do mean this file then the script needs to be modified!&lt;BR /&gt;&lt;BR /&gt;Tim&lt;/FILE&gt;</description>
      <pubDate>Tue, 11 Sep 2001 09:53:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/please-help/m-p/2577572#M858926</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2001-09-11T09:53:39Z</dc:date>
    </item>
  </channel>
</rss>

