<?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: Script to copy lines with certain string present in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828126#M100504</link>
    <description>but the dupilicates happen after the perl ... so shouldn't the sort happen after the perl to get rid of the lines?</description>
    <pubDate>Fri, 21 Jul 2006 07:53:30 GMT</pubDate>
    <dc:creator>Coolmar</dc:creator>
    <dc:date>2006-07-21T07:53:30Z</dc:date>
    <item>
      <title>Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828119#M100497</link>
      <description>I have a file that contains many lines like the following:&lt;BR /&gt;&lt;BR /&gt;/u01/oracle/product/8.1.7/bin/oracle::::APPLICATIONS,abc09def&lt;BR /&gt;&lt;BR /&gt;I need a script that will find all lines with 8.1.9 and copy that exact line right underneath the original line but replace with 8.1.7 with 9.2.0...so it looks like the following:&lt;BR /&gt;&lt;BR /&gt;/u01/oracle/product/8.1.7/bin/oracle::::APPLICATIONS,abc09def&lt;BR /&gt;/u01/oracle/product/9.2.0/bin/oracle::::APPLICATIONS,abc09def&lt;BR /&gt;&lt;BR /&gt;Thanks for the help!</description>
      <pubDate>Fri, 21 Jul 2006 06:50:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828119#M100497</guid>
      <dc:creator>Coolmar</dc:creator>
      <dc:date>2006-07-21T06:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828120#M100498</link>
      <description>Hi sally:&lt;BR /&gt;&lt;BR /&gt;# perl -nle 'print;print if s%/8.1.7/%/9.2.0/%' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 21 Jul 2006 07:02:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828120#M100498</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-07-21T07:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828121#M100499</link>
      <description>Hi (again) Sally:&lt;BR /&gt;&lt;BR /&gt;To be strictly safe in our matching, i *should* escape the dot character :-))&lt;BR /&gt;&lt;BR /&gt;# perl -nle 'print;print if s%/8\.1\.7/%/9\.2\.0/%' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 21 Jul 2006 07:24:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828121#M100499</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-07-21T07:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828122#M100500</link>
      <description>Thanks again James....now is there a way to delete any duplicate lines?</description>
      <pubDate>Fri, 21 Jul 2006 07:34:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828122#M100500</guid>
      <dc:creator>Coolmar</dc:creator>
      <dc:date>2006-07-21T07:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828123#M100501</link>
      <description>Hi Sally,&lt;BR /&gt;&lt;BR /&gt;to remove duplicate use &lt;BR /&gt;&lt;BR /&gt;cat /tmp/test |sort |uniq&lt;BR /&gt;&lt;BR /&gt;will give only one line &lt;BR /&gt;&lt;BR /&gt;Chan</description>
      <pubDate>Fri, 21 Jul 2006 07:39:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828123#M100501</guid>
      <dc:creator>Chan 007</dc:creator>
      <dc:date>2006-07-21T07:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828124#M100502</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;awk '/8.1.7/ {print}' filename |&lt;BR /&gt;sed 's/8.1.7/9.2.0/g' |sort |sort -u &lt;BR /&gt;&lt;BR /&gt;This is not so beautiful as with perl, but it looks much simpler 8))))&lt;BR /&gt;&lt;BR /&gt;HTH</description>
      <pubDate>Fri, 21 Jul 2006 07:39:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828124#M100502</guid>
      <dc:creator>Victor Fridyev</dc:creator>
      <dc:date>2006-07-21T07:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828125#M100503</link>
      <description>Hi (again) Sally:&lt;BR /&gt;&lt;BR /&gt;You don't need extra processes spawned (e.g. 'cat' into a pipe).  Rather:&lt;BR /&gt;&lt;BR /&gt;# sort -u file|perl -nle 'print;print if s%/8\.1\.7/%/9\.2\.0/%'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Jul 2006 07:44:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828125#M100503</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-07-21T07:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828126#M100504</link>
      <description>but the dupilicates happen after the perl ... so shouldn't the sort happen after the perl to get rid of the lines?</description>
      <pubDate>Fri, 21 Jul 2006 07:53:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828126#M100504</guid>
      <dc:creator>Coolmar</dc:creator>
      <dc:date>2006-07-21T07:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828127#M100505</link>
      <description>Hi Sally:&lt;BR /&gt;&lt;BR /&gt;You wrote, "but the duplicates happen after the perl ... so shouldn't the sort happen after the perl to get rid of the lines?"&lt;BR /&gt;&lt;BR /&gt;Please show some input and the output you want.  I'm confused by your question.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF... &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Jul 2006 07:59:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828127#M100505</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-07-21T07:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828128#M100506</link>
      <description>It's ok, I figured it out.  &lt;BR /&gt;Now, when I do the sort -u it sorts the whole file...is there a way to tell it to sort only on lines beginning with /u01  and leave the rest of the file entact?</description>
      <pubDate>Fri, 21 Jul 2006 08:19:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828128#M100506</guid>
      <dc:creator>Coolmar</dc:creator>
      <dc:date>2006-07-21T08:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script to copy lines with certain string present</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828129#M100507</link>
      <description>Here's an awk construct that adds lines with 9.2.0 below each of the lines containing 8.1.7 and removes only those duplicate lines that begin with "/u01".&lt;BR /&gt;&lt;BR /&gt;cat inp | awk '{x=$0;print x;if(x~/8.1.7/){gsub("8.1.7","9.2.0");print}}' | awk '{if($0~/^\/u01/)l[$0]++;else print} END{for(i in l) print i}' &amp;gt; out&lt;BR /&gt;&lt;BR /&gt;~cheers</description>
      <pubDate>Fri, 21 Jul 2006 11:46:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-copy-lines-with-certain-string-present/m-p/3828129#M100507</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-07-21T11:46:53Z</dc:date>
    </item>
  </channel>
</rss>

