<?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: Scripting Question in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting-question/m-p/4861789#M70842</link>
    <description>My good man that's exactly what I'm looking for! &lt;BR /&gt;&lt;BR /&gt;Works a treat!</description>
    <pubDate>Tue, 21 Sep 2004 08:27:28 GMT</pubDate>
    <dc:creator>Michael Williams_6</dc:creator>
    <dc:date>2004-09-21T08:27:28Z</dc:date>
    <item>
      <title>Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-question/m-p/4861787#M70840</link>
      <description>Hello all (again, I swear I post more than anyone else on here!),&lt;BR /&gt;&lt;BR /&gt;We're using SuSE here and the installation can be a little manual at time. Now most installs we use a Ghost image - so that's easy, but there are a couple of custom installs where we can't use Ghost and need to make lots of manual modifications to files that I'd like to automate.&lt;BR /&gt;&lt;BR /&gt;Now, consider the /etc/profile file as a good example. My default one has the line:&lt;BR /&gt;&lt;BR /&gt;test -z "$MAIL" &amp;amp;&amp;amp; MAIL=/var/spool/mail/$USER&lt;BR /&gt;&lt;BR /&gt;But I'd like that just to be (for backward compatibility in users' profiles):&lt;BR /&gt;&lt;BR /&gt;MAIL=/var/spool/mail/$USER&lt;BR /&gt;&lt;BR /&gt;Now I could achieve this in a script by:&lt;BR /&gt;&lt;BR /&gt;sed -e 's/test -z "$MAIL" &amp;amp;&amp;amp; MAIL=\/var\/spool\/mail\/$USER/MAIL=\/var\/spool\/mail\/$USER/' /etc/profile &amp;gt; /tmp/profile2; mv /tmp/profile2 /etc/profile&lt;BR /&gt;&lt;BR /&gt;Which is a bit messy, and if I have multiple lines to modify in the file, then I'm going to a lot of file copying.&lt;BR /&gt;&lt;BR /&gt;Can anyone suggest a simpler method to automate this? It would be nice if the file could be modified directly rather than having to use redirects...&lt;BR /&gt;&lt;BR /&gt;Any ideas chaps?&lt;BR /&gt;&lt;BR /&gt;Mike</description>
      <pubDate>Tue, 21 Sep 2004 05:25:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-question/m-p/4861787#M70840</guid>
      <dc:creator>Michael Williams_6</dc:creator>
      <dc:date>2004-09-21T05:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-question/m-p/4861788#M70841</link>
      <description>perl -p -i.bak -w -e 's/change/replaced/g' filename&lt;BR /&gt;&lt;BR /&gt;will replace each "change" string with "replaced" in file named "filename" and it will create a backup "filename.bak" in case something went wrong.&lt;BR /&gt;-p option tells perl to write a program&lt;BR /&gt;-i.bak stands for extension of a backup&lt;BR /&gt;-w turns on warnings&lt;BR /&gt;-e says that executable code follows.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Sep 2004 07:18:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-question/m-p/4861788#M70841</guid>
      <dc:creator>Alexander Chuzhoy</dc:creator>
      <dc:date>2004-09-21T07:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-question/m-p/4861789#M70842</link>
      <description>My good man that's exactly what I'm looking for! &lt;BR /&gt;&lt;BR /&gt;Works a treat!</description>
      <pubDate>Tue, 21 Sep 2004 08:27:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-question/m-p/4861789#M70842</guid>
      <dc:creator>Michael Williams_6</dc:creator>
      <dc:date>2004-09-21T08:27:28Z</dc:date>
    </item>
  </channel>
</rss>

