<?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: delete lines and adding blank line in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717980#M62334</link>
    <description>Hi Raji,&lt;BR /&gt;&lt;BR /&gt;how about using "awk" (even though it's an old tool, and Clay and procura will present a solution in "perl" ;-)?&lt;BR /&gt;&lt;BR /&gt;awk -F script.awk your.file &amp;gt; new.file&lt;BR /&gt;&lt;BR /&gt;and the script "script.awk":&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/awk&lt;BR /&gt;BEGIN { count=0 }&lt;BR /&gt;"$0" == "your case#1" { count++; if (count &amp;lt;= 1) print }&lt;BR /&gt;"$0" == "your case#2" { print; print ""; }&lt;BR /&gt;# end of script.awk&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch&lt;BR /&gt;</description>
    <pubDate>Mon, 06 May 2002 18:03:31 GMT</pubDate>
    <dc:creator>Wodisch</dc:creator>
    <dc:date>2002-05-06T18:03:31Z</dc:date>
    <item>
      <title>delete lines and adding blank line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717978#M62332</link>
      <description>I have a file which has multiple occurences of the same line. I need to keep the first Occurance and delete the rest. Next thing I want to do is And also based on the value of some lines I need to insert a blank line.&lt;BR /&gt;&lt;BR /&gt;Anyone out there can give me a hint?&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 06 May 2002 17:45:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717978#M62332</guid>
      <dc:creator>sheevm</dc:creator>
      <dc:date>2002-05-06T17:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: delete lines and adding blank line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717979#M62333</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;See 'uniq' for eliminating multiple occurances of a line.&lt;BR /&gt;&lt;BR /&gt;For adding a blank line after a particular pattern, you could do:&lt;BR /&gt;&lt;BR /&gt;# awk '{if ($0~/JKL/) {print $0"\n"} else {print $0}}' /tmp/input &amp;gt; /tmp/output&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 06 May 2002 17:56:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717979#M62333</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-05-06T17:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: delete lines and adding blank line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717980#M62334</link>
      <description>Hi Raji,&lt;BR /&gt;&lt;BR /&gt;how about using "awk" (even though it's an old tool, and Clay and procura will present a solution in "perl" ;-)?&lt;BR /&gt;&lt;BR /&gt;awk -F script.awk your.file &amp;gt; new.file&lt;BR /&gt;&lt;BR /&gt;and the script "script.awk":&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/awk&lt;BR /&gt;BEGIN { count=0 }&lt;BR /&gt;"$0" == "your case#1" { count++; if (count &amp;lt;= 1) print }&lt;BR /&gt;"$0" == "your case#2" { print; print ""; }&lt;BR /&gt;# end of script.awk&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch&lt;BR /&gt;</description>
      <pubDate>Mon, 06 May 2002 18:03:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717980#M62334</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2002-05-06T18:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: delete lines and adding blank line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717981#M62335</link>
      <description>Hi Raji:&lt;BR /&gt;&lt;BR /&gt;Another simple way to delete multiple occurences of lines:&lt;BR /&gt;&lt;BR /&gt;# sort -u filename &amp;gt; new_file&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Shiju</description>
      <pubDate>Mon, 06 May 2002 18:10:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717981#M62335</guid>
      <dc:creator>Helen French</dc:creator>
      <dc:date>2002-05-06T18:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: delete lines and adding blank line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717982#M62336</link>
      <description>Raji&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;try doing a sort and then counting the no. of lines for that acuurances and then deleteing the count -1 for that acouurance from that file. for eg&lt;BR /&gt;say a file has&lt;BR /&gt;&lt;BR /&gt;aa&lt;BR /&gt;aa&lt;BR /&gt;aa&lt;BR /&gt;aa&lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;cd&lt;BR /&gt;dd&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and what o/p you want is &lt;BR /&gt;aa&lt;BR /&gt;  &lt;BR /&gt;  &lt;BR /&gt;  &lt;BR /&gt;bb&lt;BR /&gt;cc&lt;BR /&gt;cd&lt;BR /&gt;dd&lt;BR /&gt;&lt;BR /&gt;you can try this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;A=`cat &lt;FILENAME&gt; | sort | grep aa |wc -l`&lt;BR /&gt;B=`expr $A - 1`&lt;BR /&gt;&lt;BR /&gt;cat &lt;FILENAME&gt; | sort &amp;gt; filename2&lt;BR /&gt;cat filename2 | sed -e "2,$B s/aa/  /g" &amp;gt; filename3&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and filename3 is what you want .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Manoj Srivastava&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILENAME&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 06 May 2002 18:13:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717982#M62336</guid>
      <dc:creator>MANOJ SRIVASTAVA</dc:creator>
      <dc:date>2002-05-06T18:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: delete lines and adding blank line</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717983#M62337</link>
      <description>Thanks guys. I am trying to combine all the ideas.&lt;BR /&gt;&lt;BR /&gt;It should work fine.&lt;BR /&gt;</description>
      <pubDate>Mon, 06 May 2002 19:22:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/delete-lines-and-adding-blank-line/m-p/2717983#M62337</guid>
      <dc:creator>sheevm</dc:creator>
      <dc:date>2002-05-06T19:22:59Z</dc:date>
    </item>
  </channel>
</rss>

