<?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: sed usage in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640177#M809054</link>
    <description>There is a lot of good advice about changing the root password shell above.  Take it.&lt;BR /&gt;&lt;BR /&gt;There is no difference between ksh and sh on hpux anymore, so NO reason to make this change anyway.</description>
    <pubDate>Wed, 05 Oct 2005 16:08:21 GMT</pubDate>
    <dc:creator>Stuart Abramson</dc:creator>
    <dc:date>2005-10-05T16:08:21Z</dc:date>
    <item>
      <title>sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640168#M809045</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I am writing a setup srcipt which want to replace one line of the file /etc/passwd &lt;BR /&gt;&lt;BR /&gt;root::0:3::/:/sbin/sh&lt;BR /&gt;daemon:*:1:5::/:/sbin/sh&lt;BR /&gt;bin:*:2:2::/usr/bin:/sbin/sh&lt;BR /&gt;sys:*:3:3::/:&lt;BR /&gt;adm:*:4:4::/var/adm:/sbin/sh&lt;BR /&gt;uucp:*:5:3::/var/spool/uucppublic:/usr/lbin/uucp/uucico&lt;BR /&gt;lp:*:9:7::/var/spool/lp:/sbin/sh&lt;BR /&gt;nuucp:*:11:11::/var/spool/uucppublic:/usr/lbin/uucp/uucico&lt;BR /&gt;hpdb:*:27:1:ALLBASE:/:/sbin/sh&lt;BR /&gt;nobody:*:-2:-2::/:&lt;BR /&gt;www:*:30:1::/:&lt;BR /&gt;smbnull:*:101:101:DO NOT USE OR DELETE - needed by Samba:/home/smbnull:/sbin/sh&lt;BR /&gt;&lt;BR /&gt;to root::0:3::/.root:/sbin/ksh, my idea is to use sed &lt;BR /&gt;&lt;BR /&gt;grep root /etc/passwd | sed -e 's/"/"/"/.root"/' -e 's/"/sbin/sh"/"/sbin/ksh"/'&lt;BR /&gt;but I find that the character / is the special.&lt;BR /&gt;&lt;BR /&gt;Do anyone has an idea? Thanks</description>
      <pubDate>Mon, 03 Oct 2005 05:55:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640168#M809045</guid>
      <dc:creator>Achilles_2</dc:creator>
      <dc:date>2005-10-03T05:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640169#M809046</link>
      <description>You can use \/ instead. &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Mon, 03 Oct 2005 05:58:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640169#M809046</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2005-10-03T05:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640170#M809047</link>
      <description>You're trying to change root's shell to the korn shell?  This is NOT a good idea.  When you need to boot into single user mode, the korn shell is not going to be available, because /usr is not mounted.  And, unless you managed to put it there, which is unlikely because it's dynamically rather than staticaly linked, ksh is not in /sbin, anyway.&lt;BR /&gt;&lt;BR /&gt;I would rethink this whole proposal if I were you.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Mon, 03 Oct 2005 06:01:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640170#M809047</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2005-10-03T06:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640171#M809048</link>
      <description>If you want to change /etc/passwd file then use passwd command first.  Leave root account's shell as /sbin/sh. It is the only one account going to be used in single user mode.&lt;BR /&gt;&lt;BR /&gt;If you want to play manually then,&lt;BR /&gt;&lt;BR /&gt;# cp -p /etc/passwd /etc/passwd.bak&lt;BR /&gt;# passwd -e /sbin/ksh root&lt;BR /&gt;&lt;BR /&gt;It will change /sbin/sh to /sbin/ksh&lt;BR /&gt;&lt;BR /&gt;hth.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 03 Oct 2005 06:04:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640171#M809048</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-03T06:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640172#M809049</link>
      <description>there is no /sbin/ksh available on HP-UX. Double check before doing anything, &lt;BR /&gt;&lt;BR /&gt;# ls /sbin/ksh (11.11 and 11.23) &lt;BR /&gt;/sbin/ksh not found&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Mon, 03 Oct 2005 06:06:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640172#M809049</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2005-10-03T06:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640173#M809050</link>
      <description>As Pete says you probably want to rethink what you are trying to do, but for future reference you can use another delimiter with sed if you want.&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;# sed -e 's|before|after|g' file&lt;BR /&gt;&lt;BR /&gt;uses the pipe symbol '|' as the delimiter.&lt;BR /&gt;&lt;BR /&gt;so in your case ...&lt;BR /&gt;&lt;BR /&gt;grep "^root:" /etc/passwd | sed -e 's|/sbin/sh|/sbin/ksh|'</description>
      <pubDate>Mon, 03 Oct 2005 06:09:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640173#M809050</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2005-10-03T06:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640174#M809051</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Pete is correct.  Unless you only want to boot your system one last time, do *NOT* change root's shell!  It must remain '/sbin/sh' as he noted.  On HP-UX, 'sh' is the POSIX shell which is a superset of the Korn88 shell -- which is all you get with '/usr/bin/ksh'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 03 Oct 2005 06:12:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640174#M809051</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-10-03T06:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640175#M809052</link>
      <description>For sed practice you can try as,&lt;BR /&gt;&lt;BR /&gt;# sed -e '/root/s/sh/ksh/g' /etc/passwd&lt;BR /&gt;&lt;BR /&gt;It won't update in /etc/passwd&lt;BR /&gt;&lt;BR /&gt;You can negate / with \ or else s## instead of s// or s%%.&lt;BR /&gt;&lt;BR /&gt;# echo "root::0:3::/.root:/sbin/sh" | sed -e '/root/s%/sbin/sh%/sbin/ksh%'&lt;BR /&gt;root::0:3::/.root:/sbin/ksh&lt;BR /&gt;# echo "root::0:3::/.root:/sbin/sh" | sed -e '/root/s#/sbin/sh#/sbin/ksh#'&lt;BR /&gt;root::0:3::/.root:/sbin/ksh&lt;BR /&gt;# echo "root::0:3::/.root:/sbin/sh" | sed -e '/root/s/\/sbin\/sh/\/sbin\/ksh/'&lt;BR /&gt;root::0:3::/.root:/sbin/ksh&lt;BR /&gt;# echo "root::0:3::/.root:/sbin/sh" | sed -e '/root/s|/sbin/sh|/sbin/ksh|'&lt;BR /&gt;root::0:3::/.root:/sbin/ksh&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Mon, 03 Oct 2005 06:13:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640175#M809052</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-03T06:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640176#M809053</link>
      <description>How about using /usr/sbin/logins command to generate list of users then use that list as input to /usr/sbin/usermod command for each users in for loop?&lt;BR /&gt;It fails for users that are logged on, but can be scheduled to run offshift.</description>
      <pubDate>Wed, 05 Oct 2005 13:43:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640176#M809053</guid>
      <dc:creator>John M.</dc:creator>
      <dc:date>2005-10-05T13:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640177#M809054</link>
      <description>There is a lot of good advice about changing the root password shell above.  Take it.&lt;BR /&gt;&lt;BR /&gt;There is no difference between ksh and sh on hpux anymore, so NO reason to make this change anyway.</description>
      <pubDate>Wed, 05 Oct 2005 16:08:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage/m-p/3640177#M809054</guid>
      <dc:creator>Stuart Abramson</dc:creator>
      <dc:date>2005-10-05T16:08:21Z</dc:date>
    </item>
  </channel>
</rss>

