<?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 Script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759338#M72043</link>
    <description>Hi there,&lt;BR /&gt;&lt;BR /&gt;I am trying to write a script that takes 2 lists of userID's and removes the contents of one from the other. For example, I am using the cut command to remove the first field from the /etc/passwd file. This leaves me with my first list of userID's. I also have a manually created list of users. This second list is much shorter.&lt;BR /&gt;&lt;BR /&gt;I want a script that removes the users in the second (shorter) list from the longer passwd file generated list and outputs the remaining users to a file.&lt;BR /&gt;&lt;BR /&gt;I'm sure some of you guys can help me out on this and I will be very greatful if you could do so.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Christian Briddon</description>
    <pubDate>Mon, 08 Jul 2002 13:32:46 GMT</pubDate>
    <dc:creator>Christian Briddon_1</dc:creator>
    <dc:date>2002-07-08T13:32:46Z</dc:date>
    <item>
      <title>Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759338#M72043</link>
      <description>Hi there,&lt;BR /&gt;&lt;BR /&gt;I am trying to write a script that takes 2 lists of userID's and removes the contents of one from the other. For example, I am using the cut command to remove the first field from the /etc/passwd file. This leaves me with my first list of userID's. I also have a manually created list of users. This second list is much shorter.&lt;BR /&gt;&lt;BR /&gt;I want a script that removes the users in the second (shorter) list from the longer passwd file generated list and outputs the remaining users to a file.&lt;BR /&gt;&lt;BR /&gt;I'm sure some of you guys can help me out on this and I will be very greatful if you could do so.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Christian Briddon</description>
      <pubDate>Mon, 08 Jul 2002 13:32:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759338#M72043</guid>
      <dc:creator>Christian Briddon_1</dc:creator>
      <dc:date>2002-07-08T13:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759339#M72044</link>
      <description>Hi Chsirtian,&lt;BR /&gt;&lt;BR /&gt;i don't have a system at hand right now. But i think something like this will work in the normal shell:&lt;BR /&gt;&lt;BR /&gt;while read user&lt;BR /&gt;do&lt;BR /&gt;  grep -v $user longfile &amp;gt; tmpfile&lt;BR /&gt;  mv tmpfile longfile&lt;BR /&gt;done &amp;lt; shortfile&lt;BR /&gt;&lt;BR /&gt;Where shortfile is your manually created list. Lonfile is your extract from /etc/passwd. And tmpfile is just a temp. file like /tmp/working.lst&lt;BR /&gt;&lt;BR /&gt;But please do a test with some copied lists first. I don't want to be responsible for any loss of data ;-)&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Regards Stefan</description>
      <pubDate>Mon, 08 Jul 2002 13:42:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759339#M72044</guid>
      <dc:creator>Stefan Schulz</dc:creator>
      <dc:date>2002-07-08T13:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759340#M72045</link>
      <description>Try this:&lt;BR /&gt;diff xx1 xx2 | grep '^&amp;lt;' | sed 's/&amp;lt; //' &amp;gt; newlist</description>
      <pubDate>Mon, 08 Jul 2002 13:42:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759340#M72045</guid>
      <dc:creator>Rich Wright</dc:creator>
      <dc:date>2002-07-08T13:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759341#M72046</link>
      <description># cat /tmp/short                        &lt;BR /&gt;abc10&lt;BR /&gt;abc99&lt;BR /&gt;def5&lt;BR /&gt;# cat /tmp/long &lt;BR /&gt;abc01&lt;BR /&gt;abc02&lt;BR /&gt;abc03&lt;BR /&gt;abc10&lt;BR /&gt;abc55&lt;BR /&gt;abc77&lt;BR /&gt;abc99&lt;BR /&gt;bef01&lt;BR /&gt;def5&lt;BR /&gt;def6&lt;BR /&gt;# cat /tmp/long | grep -v -f /tmp/short&lt;BR /&gt;abc01&lt;BR /&gt;abc02&lt;BR /&gt;abc03&lt;BR /&gt;abc55&lt;BR /&gt;abc77&lt;BR /&gt;bef01&lt;BR /&gt;def6&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 08 Jul 2002 13:43:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759341#M72046</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-07-08T13:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759342#M72047</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;let us suppose file A is the smaller file , and file B is the bigger file , to create file which should have all the users in file B but not in A then you can do like this&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat file A |&lt;BR /&gt;while read user&lt;BR /&gt;do&lt;BR /&gt;cat B | grep -v $user &amp;gt;&amp;gt; new file&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this will do the job.&lt;BR /&gt;&lt;BR /&gt;Manoj Srivastava&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jul 2002 13:47:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759342#M72047</guid>
      <dc:creator>MANOJ SRIVASTAVA</dc:creator>
      <dc:date>2002-07-08T13:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759343#M72048</link>
      <description>No system, no man pages :-(&lt;BR /&gt;&lt;BR /&gt;i think Harry's method is the best and fastest. So 10 points to him.&lt;BR /&gt;&lt;BR /&gt;Regards Stefan</description>
      <pubDate>Mon, 08 Jul 2002 13:55:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759343#M72048</guid>
      <dc:creator>Stefan Schulz</dc:creator>
      <dc:date>2002-07-08T13:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759344#M72049</link>
      <description>BTW:&lt;BR /&gt;&lt;BR /&gt;you don't have to use cat here. grep will read from the file directly. So using Harry's solution, this should be the fastest:&lt;BR /&gt;&lt;BR /&gt;grep -v -f /tmp/short /tmp/long&lt;BR /&gt;&lt;BR /&gt;Regards Stefan</description>
      <pubDate>Mon, 08 Jul 2002 13:58:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759344#M72049</guid>
      <dc:creator>Stefan Schulz</dc:creator>
      <dc:date>2002-07-08T13:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759345#M72050</link>
      <description>I recend my first suggestion.&lt;BR /&gt;I like&lt;BR /&gt;grep -v -f short_file long_file &amp;gt; new_file&lt;BR /&gt;With the exception of having entries in the short_file look like "^userid$" instead of just "userid".&lt;BR /&gt;Then you will not remove "abc10", "abc1", or "test_abc" with a short_file entry of "abc".</description>
      <pubDate>Mon, 08 Jul 2002 13:59:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759345#M72050</guid>
      <dc:creator>Rich Wright</dc:creator>
      <dc:date>2002-07-08T13:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759346#M72051</link>
      <description>Adding the "-x" option will satisfy the request:&lt;BR /&gt;&lt;BR /&gt;# cat /tmp/short                          &lt;BR /&gt;abc10&lt;BR /&gt;abc99&lt;BR /&gt;def5&lt;BR /&gt;# cat /tmp/long                           &lt;BR /&gt;abc01&lt;BR /&gt;abc02&lt;BR /&gt;abc03&lt;BR /&gt;abc10&lt;BR /&gt;abc55&lt;BR /&gt;abc77&lt;BR /&gt;abc99&lt;BR /&gt;bef01&lt;BR /&gt;def5&lt;BR /&gt;def6&lt;BR /&gt;def56&lt;BR /&gt;def65&lt;BR /&gt;# cat /tmp/long | grep -v -x -f /tmp/short&lt;BR /&gt;abc01&lt;BR /&gt;abc02&lt;BR /&gt;abc03&lt;BR /&gt;abc55&lt;BR /&gt;abc77&lt;BR /&gt;bef01&lt;BR /&gt;def6&lt;BR /&gt;def56&lt;BR /&gt;def65&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;or as put by Stefan:&lt;BR /&gt;&lt;BR /&gt;grep -v -x -f /tmp/short /tmp/long&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 08 Jul 2002 14:10:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759346#M72051</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-07-08T14:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759347#M72052</link>
      <description>&lt;BR /&gt;comm -23 /path/to/longlist /path/to/shortlist&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jul 2002 15:17:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759347#M72052</guid>
      <dc:creator>Jordan Bean</dc:creator>
      <dc:date>2002-07-08T15:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759348#M72053</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;As I can see your problem already is solved but if you are interested in shell programming&lt;BR /&gt;there is a command just for your need called "join". Have a look at it (man join).&lt;BR /&gt;&lt;BR /&gt;In the example above it should look:&lt;BR /&gt;&lt;BR /&gt;join -v 2 /tmp/short /tmp/long</description>
      <pubDate>Mon, 08 Jul 2002 17:47:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759348#M72053</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2002-07-08T17:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759349#M72054</link>
      <description>Just like to say a big thanks for all of your posts. The script is now working fine and I have allocated points accordingly.&lt;BR /&gt;&lt;BR /&gt;Christian Briddon</description>
      <pubDate>Tue, 09 Jul 2002 06:20:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2759349#M72054</guid>
      <dc:creator>Christian Briddon_1</dc:creator>
      <dc:date>2002-07-09T06:20:28Z</dc:date>
    </item>
  </channel>
</rss>

