<?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: Shell Scripting Help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669682#M50596</link>
    <description>It is better to use "printf" insted of "print"  along with awk.</description>
    <pubDate>Fri, 22 Feb 2002 06:04:51 GMT</pubDate>
    <dc:creator>RAJESH GANGADHARAN</dc:creator>
    <dc:date>2002-02-22T06:04:51Z</dc:date>
    <item>
      <title>Shell Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669677#M50591</link>
      <description>I want to make a script that will output&lt;BR /&gt;UID User Name and Information.&lt;BR /&gt;In the script I wrote the collumns do not&lt;BR /&gt;line up.  Can you help me align the collumns?&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;cat /etc/passwd &amp;gt; /tmp/build0&lt;BR /&gt;sort -t: +2 /tmp/build0 &amp;gt; /tmp/build1&lt;BR /&gt;&lt;BR /&gt;grep -v root /tmp/build1 &amp;gt; /tmp/build2&lt;BR /&gt;grep -v datatel /tmp/build2 &amp;gt; /tmp/build3&lt;BR /&gt;grep -v wordmarc /tmp/build3 &amp;gt; /tmp/build4&lt;BR /&gt;grep -v artsmart /tmp/build4 &amp;gt; /tmp/build5&lt;BR /&gt;grep -v udmsmgr /tmp/build5 &amp;gt; /tmp/build6&lt;BR /&gt;grep -v :bin: /tmp/build6 &amp;gt; /tmp/build7&lt;BR /&gt;grep -v lp /tmp/build7 &amp;gt; /tmp/build8&lt;BR /&gt;grep -v uucp /tmp/build8 &amp;gt; /tmp/build9&lt;BR /&gt;grep -v www /tmp/build9 &amp;gt; /tmp/build10&lt;BR /&gt;grep -v nobody /tmp/build10 &amp;gt; /tmp/build11&lt;BR /&gt;grep -v adm /tmp/build11 &amp;gt; /tmp/build12&lt;BR /&gt;grep -v sys /tmp/build12 &amp;gt; /tmp/build13&lt;BR /&gt;grep -v hpdb /tmp/build13 &amp;gt; /tmp/build14&lt;BR /&gt;&lt;BR /&gt;awk -F: '{print $3, $5}' /tmp/build14 &amp;gt; /tmp/build15&lt;BR /&gt;&lt;BR /&gt;sed 's/,/                /g' /tmp/build15 &amp;gt; /tmp/build16&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2002 22:43:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669677#M50591</guid>
      <dc:creator>David Peacock</dc:creator>
      <dc:date>2002-02-21T22:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669678#M50592</link>
      <description>This line:&lt;BR /&gt;sed 's/,/ /g' /tmp/build15 &amp;gt; /tmp/build16 &lt;BR /&gt;&lt;BR /&gt;Should read:&lt;BR /&gt;&lt;BR /&gt;sed 's/,/&lt;TAB&gt;&lt;TAB&gt; /g' /tmp/build15 &amp;gt; /tmp/build16 &lt;BR /&gt;&lt;BR /&gt;&lt;/TAB&gt;&lt;/TAB&gt;</description>
      <pubDate>Thu, 21 Feb 2002 22:47:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669678#M50592</guid>
      <dc:creator>David Peacock</dc:creator>
      <dc:date>2002-02-21T22:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669679#M50593</link>
      <description>Hi David:&lt;BR /&gt;&lt;BR /&gt;First, I would replace all those temp files with a series of pipes. Simply pipe the output of 1 command to the next. To fix your alignment change your awk print statement to a printf.&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;awk -F: '{printf("%5d\t%s\n",$3,$5)}' /tmp/build14 &amp;gt; /tmp/build15&lt;BR /&gt;&lt;BR /&gt;That should do it, Clay</description>
      <pubDate>Thu, 21 Feb 2002 22:54:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669679#M50593</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-02-21T22:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669680#M50594</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;If you use the printf to format the output, you shouldn't even need your last sed. I did intentionally insert a tab \t in the printf but, if you prefer, you can simply replace it with a space.&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2002 23:14:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669680#M50594</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-02-21T23:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669681#M50595</link>
      <description>You could do this:&lt;BR /&gt;&lt;BR /&gt;awk -F: '{print $3,$1,$5}' /etc/passwd | egrep -v 'root|nobody' &amp;gt; /tmp/password_format.out&lt;BR /&gt;&lt;BR /&gt;Add the strings that you would want to get rid of after nobody and as many pipes as you would need ...&lt;BR /&gt;&lt;BR /&gt;Hope this helps !&lt;BR /&gt;&lt;BR /&gt;-Shabu</description>
      <pubDate>Thu, 21 Feb 2002 23:18:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669681#M50595</guid>
      <dc:creator>SHABU KHAN</dc:creator>
      <dc:date>2002-02-21T23:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669682#M50596</link>
      <description>It is better to use "printf" insted of "print"  along with awk.</description>
      <pubDate>Fri, 22 Feb 2002 06:04:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669682#M50596</guid>
      <dc:creator>RAJESH GANGADHARAN</dc:creator>
      <dc:date>2002-02-22T06:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669683#M50597</link>
      <description>There is a HP-UX command that may be of interest here:&lt;BR /&gt;&lt;BR /&gt;# logins -u</description>
      <pubDate>Fri, 22 Feb 2002 15:49:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669683#M50597</guid>
      <dc:creator>Kirk Gardner</dc:creator>
      <dc:date>2002-02-22T15:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669684#M50598</link>
      <description>&lt;BR /&gt;cat /etc/passwd | sort -t: +2 | grep -v -e root -e datatel -e wordmarc -e artsma&lt;BR /&gt;rt -e udmsmgr -e ":bin:" -e lp -e uucp -e www -e nobody -e adm -e sys -e hpdb |&lt;BR /&gt;cut -d":" -f3,5 | sed 's/,/ /g'| awk -F: '{printf("%5d %s\n",$1,$2)}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note with grep, you can use the "-e" option for more pattern matches.&lt;BR /&gt;I also removed all of the unnecessary temporary files, and I used awk to format the output.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Fri, 22 Feb 2002 16:06:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669684#M50598</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-02-22T16:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Shell Scripting Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669685#M50599</link>
      <description>Hi David,&lt;BR /&gt;&lt;BR /&gt;Another thing you may want to consider is using the -f switch in grep.  Put all the strings to exclude in a file and use:&lt;BR /&gt;&lt;BR /&gt;cat /etc/passwd | sort -t: +2 | grep -v -f exclude_file | cut -d":" -f3,5 | sed 's/,/ /g'| awk -F: '{printf("%5d %s\n",$1,$2)}'&lt;BR /&gt;&lt;BR /&gt;This might make it easier to maintain should you wish to amend the list.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Fri, 22 Feb 2002 16:31:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-scripting-help/m-p/2669685#M50599</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-02-22T16:31:15Z</dc:date>
    </item>
  </channel>
</rss>

