<?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: duplicates in a file in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978980#M99568</link>
    <description>lawrenzo,&lt;BR /&gt;Attached a little script, which may be a step towards your solution.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 15 May 2006 07:05:53 GMT</pubDate>
    <dc:creator>Peter Godron</dc:creator>
    <dc:date>2006-05-15T07:05:53Z</dc:date>
    <item>
      <title>duplicates in a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978979#M99567</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I am trying to write a small script but struggling what to use:&lt;BR /&gt;&lt;BR /&gt;I have a file with the user id then some loggin info however this is duplicated for some instances ie:&lt;BR /&gt;&lt;BR /&gt;&lt;USERID&gt;&lt;BR /&gt;&lt;BR /&gt;time_last_login =&lt;BR /&gt;        tty_last_login =&lt;BR /&gt;        host_last_login =&lt;BR /&gt;        unsuccessful_login_count =&lt;BR /&gt;&lt;BR /&gt;&lt;NEXTUSERID&gt;&lt;BR /&gt;&lt;BR /&gt;i need to search the file to find the user id, keeep the first instance then delete the rest but I do not know howto search userid then delete 6 lines from where the uid is.&lt;BR /&gt;&lt;BR /&gt;any ideas will be a great help.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;/NEXTUSERID&gt;&lt;/USERID&gt;</description>
      <pubDate>Mon, 15 May 2006 05:43:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978979#M99567</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2006-05-15T05:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: duplicates in a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978980#M99568</link>
      <description>lawrenzo,&lt;BR /&gt;Attached a little script, which may be a step towards your solution.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 15 May 2006 07:05:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978980#M99568</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-05-15T07:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: duplicates in a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978981#M99569</link>
      <description>lawrenzo,&lt;BR /&gt;sorry, attachment missing.</description>
      <pubDate>Mon, 15 May 2006 07:23:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978981#M99569</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-05-15T07:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: duplicates in a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978982#M99570</link>
      <description>Hi,&lt;BR /&gt;Can you post the script that you are working on,&lt;BR /&gt;&lt;BR /&gt;else use this command which will provide inputs that you are looking for in one line.&lt;BR /&gt;&lt;BR /&gt;testos1:/usr/sbin/acct # ./fwtmp &amp;lt; /var/adm/wtmp&lt;BR /&gt;testos1:/usr/sbin/acct # ./fwtmp &lt;BR /&gt;Chan</description>
      <pubDate>Mon, 15 May 2006 07:38:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978982#M99570</guid>
      <dc:creator>Chan 007</dc:creator>
      <dc:date>2006-05-15T07:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: duplicates in a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978983#M99571</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I don't know if the userid you mention is literally found as "&lt;USERID&gt;" or "userid". My example assumes the latter case, but you can easily change this.&lt;BR /&gt;&lt;BR /&gt;If you mean to keep the rest of the file without duplicate entries and a record consists of skip=6 lines:&lt;BR /&gt;awk -v us="userid" -v skip=6 '$1 == us {if(have_us) for(i=0;i&lt;SKIP&gt;&lt;/SKIP&gt;have_us++&lt;BR /&gt;}&lt;BR /&gt;{print}' myfile&lt;BR /&gt;&lt;BR /&gt;To get only the first record of "userid" and nothing else:&lt;BR /&gt;awk -v us="userid" -v skip=6 '$1 == us {for(i=0;i&lt;SKIP&gt;&lt;/SKIP&gt;&lt;BR /&gt;mfG Peter&lt;/USERID&gt;</description>
      <pubDate>Mon, 15 May 2006 08:06:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978983#M99571</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-05-15T08:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: duplicates in a file</title>
      <link>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978984#M99572</link>
      <description>cheers guys&lt;BR /&gt;&lt;BR /&gt;gordon and Peter your examples are cool.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 15 May 2006 09:34:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/duplicates-in-a-file/m-p/4978984#M99572</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2006-05-15T09:34:10Z</dc:date>
    </item>
  </channel>
</rss>

