<?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: sed in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475945#M680249</link>
    <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;...and as one might expect, the permissions of the file to be edited are also preserved when using a GNU 'sed' in-place edit:&lt;BR /&gt;&lt;BR /&gt;# sed -ie 's/abc/ABC/g' test.sh&lt;BR /&gt;&lt;BR /&gt;# sed --version&lt;BR /&gt;GNU sed version 4.1.5&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Sun, 09 Aug 2009 22:58:21 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2009-08-09T22:58:21Z</dc:date>
    <item>
      <title>sed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475939#M680243</link>
      <description>&lt;P&gt;Hi i have handfull doubts in scripting.Now m stuck up with sed.&lt;BR /&gt;&lt;BR /&gt;I have heard the sed is non-interactive and used to replace words in scripts where vi is not practical.&lt;BR /&gt;&lt;BR /&gt;sed 's/abc/ABC/g' test.sh&lt;BR /&gt;&lt;BR /&gt;I want to know this will modify the same script and save it or create new script with new modifications or we need to direct the output new file ?&lt;BR /&gt;&lt;BR /&gt;and plz also tell me other use of sed.Bcoz man page is not helpful.&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P.S. This thread has been moved from&amp;nbsp;&lt;SPAN style="line-height: 15px;"&gt;HP-UX&amp;gt;System Administration to HP-UX &amp;gt; languages&lt;/SPAN&gt;&lt;SPAN style="line-height: 15px;"&gt;. -HP Forum Moderator&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2014 10:04:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475939#M680243</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2014-01-20T10:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: sed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475940#M680244</link>
      <description>&lt;!--!*#--&gt;&amp;gt; I want to know [...]&lt;BR /&gt;&lt;BR /&gt;Your fingers are apparently _not_ broken.&lt;BR /&gt;What happens when you run this command?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; and plz also tell me other use of sed.Bcoz&lt;BR /&gt;&amp;gt; man page is not helpful.&lt;BR /&gt;&lt;BR /&gt;Why, because you can't read (or write)&lt;BR /&gt;English, or because you're too lazy to read&lt;BR /&gt;the stuff, or what?  Perhaps a Forum search&lt;BR /&gt;for keywords like&lt;BR /&gt;      sed&lt;BR /&gt;would find an example or two.  Buy a book.&lt;BR /&gt;Look around on this new Inter-Web thing.&lt;BR /&gt;&lt;BR /&gt;"I'm helpless.  Please do my job for me."&lt;BR /&gt;&lt;BR /&gt;Give me a break.</description>
      <pubDate>Sun, 09 Aug 2009 11:49:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475940#M680244</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-08-09T11:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: sed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475941#M680245</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I have heard the sed is non-interactive and used to replace words in scripts where vi is not practical.&lt;BR /&gt;&lt;BR /&gt;That's true.  The 'sed' utility is designed to be used to edit a stream of data; hence the name 'sed' from "Stream EDitor".  The actions are intended to occur non-interactively.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I want to know this will modify the same script and save it or create new script with new modifications or we need to direct the output new file ?&lt;BR /&gt;&lt;BR /&gt;No and yes.&lt;BR /&gt;&lt;BR /&gt;The GNU version of 'sed' which would be found in Linux distributions offers an in-place edit using the '-i' or '--in-place' option.  Versions of 'sed' that are provided by HP-UX and AIX, for example, lack this feature.  Perhaps that is why you have found the manpages "not helpful" --- you may have seen examples using the GNU extensions.&lt;BR /&gt;&lt;BR /&gt;Thus, for tranditional 'sed' implementations you have to redirect the output to a new file and subsequently rename ('mv') the new file to the old file.  Do _not_ try to use the same output file name as the input file too.  This will not work.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 09 Aug 2009 12:36:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475941#M680245</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-09T12:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: sed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475942#M680246</link>
      <description>Hi JRF,&lt;BR /&gt;&lt;BR /&gt;Thanx for ur reply.. cleared my doubt.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have always found ur replies are more informative and very simple to understand.&lt;BR /&gt;&lt;BR /&gt;Thanx a lot&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs&lt;BR /&gt;</description>
      <pubDate>Sun, 09 Aug 2009 12:50:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475942#M680246</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2009-08-09T12:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: sed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475943#M680247</link>
      <description>&amp;gt;JRF: subsequently rename (mv) the new file to the old file.&lt;BR /&gt;&lt;BR /&gt;If these are scripts, you'll also have to make them executable with chmod(1).</description>
      <pubDate>Sun, 09 Aug 2009 18:15:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475943#M680247</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-08-09T18:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: sed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475944#M680248</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Dennis: If these are scripts, you'll also have to make them executable with chmod(1).&lt;BR /&gt;&lt;BR /&gt;Of course that's true if you use the traditional methods of shelll redirection to a new output file since the shell uses a creation mode mask of 0666 to which the process's umask is then applied.  THus following the 'mv' ('rename') a 'chmod' could have to be used to add executable permissions.&lt;BR /&gt;&lt;BR /&gt;_IF_, however, instead of 'sed' one uses Perl's inplace edit feature [ and I'm not sure if this works the same in GNU sed ] then this is not an issue.  Perl will leave the permissions of the modified file unchanged:&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e 's/abc/ABC/g' myfile&lt;BR /&gt;&lt;BR /&gt;...edits "myfile" in-place.&lt;BR /&gt;&lt;BR /&gt;# perl -pi.old -e s/abc/ABC/g' myfile&lt;BR /&gt;&lt;BR /&gt;...edits "myfile" in-place but makes a backup copy of the original file suffixed with ".old".&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 09 Aug 2009 21:46:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475944#M680248</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-09T21:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: sed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475945#M680249</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;...and as one might expect, the permissions of the file to be edited are also preserved when using a GNU 'sed' in-place edit:&lt;BR /&gt;&lt;BR /&gt;# sed -ie 's/abc/ABC/g' test.sh&lt;BR /&gt;&lt;BR /&gt;# sed --version&lt;BR /&gt;GNU sed version 4.1.5&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sun, 09 Aug 2009 22:58:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475945#M680249</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-08-09T22:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: sed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475946#M680250</link>
      <description>I know this is not the question here but I found this a better alternative than mv command to preserve the permissions of the original file in cases like the original poster is facing:&lt;BR /&gt;&lt;BR /&gt;sed 's/abc/ABC/g' test.sh &amp;gt; some_temp_file&lt;BR /&gt;cat some_temp_file &amp;gt; test.sh&lt;BR /&gt;&lt;BR /&gt;if the file is something other than text, this method has shortcomings but for text files, such as shell scripts, it works mighty fine.&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
      <pubDate>Mon, 10 Aug 2009 12:08:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed/m-p/4475946#M680250</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-08-10T12:08:25Z</dc:date>
    </item>
  </channel>
</rss>

