<?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: Deleting file lines in shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-file-lines-in-shell-script/m-p/2427383#M1848</link>
    <description>If what you are trying to do is delete lines from two files that are the same in each file try this, i made this when trying to do the same thing&lt;BR /&gt;This only works if each line is one string with no spaces&lt;BR /&gt;&lt;BR /&gt;cat file1 file2 &amp;gt;&amp;gt; tempfile&lt;BR /&gt;sort tempfile &amp;gt; temp2file&lt;BR /&gt;rm tempfile&lt;BR /&gt;uniq -d temp2file &amp;gt; temp3file&lt;BR /&gt;rm temp2file&lt;BR /&gt;(this will be a list of all line the same in both files)&lt;BR /&gt;(now to delete those lines)&lt;BR /&gt;&lt;BR /&gt;for X in `cat temp3file`&lt;BR /&gt;do&lt;BR /&gt;grep -v ^$X$ file1 &amp;gt; temp4file&lt;BR /&gt;cp temp4file file1&lt;BR /&gt;grep -v ^$X$ file2 &amp;gt; temp4file&lt;BR /&gt;cp temp4file file2&lt;BR /&gt;sleep 1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;then remember to delete temp3file and temp4file&lt;BR /&gt;i do all this in a script wich is much easier&lt;BR /&gt;but this is how i'd do it from the command line&lt;BR /&gt;</description>
    <pubDate>Mon, 26 Jun 2000 18:16:47 GMT</pubDate>
    <dc:creator>James Odak</dc:creator>
    <dc:date>2000-06-26T18:16:47Z</dc:date>
    <item>
      <title>Deleting file lines in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-file-lines-in-shell-script/m-p/2427380#M1845</link>
      <description>Is there a way to delete a line in a file if you are reading from file1 and you want to delete line from file2 matching certain critera?  I'm trying to use standard UNIX commands to accomplish.</description>
      <pubDate>Fri, 23 Jun 2000 14:44:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-file-lines-in-shell-script/m-p/2427380#M1845</guid>
      <dc:creator>Curtis Whitworth</dc:creator>
      <dc:date>2000-06-23T14:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting file lines in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-file-lines-in-shell-script/m-p/2427381#M1846</link>
      <description>The sed command is probably what you want, but the syntax can be tricky.  The man page helps, but you might want to pick up some additional references.  (O'reilly is always a good place to start.)&lt;BR /&gt;&lt;BR /&gt;If you post more details about your specific problem, I might be able to give you a more complete response.</description>
      <pubDate>Fri, 23 Jun 2000 15:03:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-file-lines-in-shell-script/m-p/2427381#M1846</guid>
      <dc:creator>Alan Riggs</dc:creator>
      <dc:date>2000-06-23T15:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting file lines in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-file-lines-in-shell-script/m-p/2427382#M1847</link>
      <description>The use of 'sed' will accomplish your goal.&lt;BR /&gt;&lt;BR /&gt;The question of "certain criteria" needs to be established. Once done, you could invoke sed. Example to delete blank lines with a file:  sed -e /^$/d&lt;BR /&gt;&lt;BR /&gt;Another option to delete lines:  sed -e /$pattern/,^$/d file &amp;gt; newfile&lt;BR /&gt;This will delete the line matching the pattern up to the first blank line.</description>
      <pubDate>Fri, 23 Jun 2000 15:06:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-file-lines-in-shell-script/m-p/2427382#M1847</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2000-06-23T15:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting file lines in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deleting-file-lines-in-shell-script/m-p/2427383#M1848</link>
      <description>If what you are trying to do is delete lines from two files that are the same in each file try this, i made this when trying to do the same thing&lt;BR /&gt;This only works if each line is one string with no spaces&lt;BR /&gt;&lt;BR /&gt;cat file1 file2 &amp;gt;&amp;gt; tempfile&lt;BR /&gt;sort tempfile &amp;gt; temp2file&lt;BR /&gt;rm tempfile&lt;BR /&gt;uniq -d temp2file &amp;gt; temp3file&lt;BR /&gt;rm temp2file&lt;BR /&gt;(this will be a list of all line the same in both files)&lt;BR /&gt;(now to delete those lines)&lt;BR /&gt;&lt;BR /&gt;for X in `cat temp3file`&lt;BR /&gt;do&lt;BR /&gt;grep -v ^$X$ file1 &amp;gt; temp4file&lt;BR /&gt;cp temp4file file1&lt;BR /&gt;grep -v ^$X$ file2 &amp;gt; temp4file&lt;BR /&gt;cp temp4file file2&lt;BR /&gt;sleep 1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;then remember to delete temp3file and temp4file&lt;BR /&gt;i do all this in a script wich is much easier&lt;BR /&gt;but this is how i'd do it from the command line&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Jun 2000 18:16:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deleting-file-lines-in-shell-script/m-p/2427383#M1848</guid>
      <dc:creator>James Odak</dc:creator>
      <dc:date>2000-06-26T18:16:47Z</dc:date>
    </item>
  </channel>
</rss>

