<?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: edit script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989113#M421748</link>
    <description>RAC procure...do either of your methods actually change all mention of /opt/CA/sche&lt;BR /&gt;to /opt/CA/sche/UM  inside all the files in the directory, including if the path name has further directories added on to it?&lt;BR /&gt;I am an absolute novice with perl and sed. (that's probably the most helpful piece of info I can give you!)&lt;BR /&gt;thanks&lt;BR /&gt;Maria.</description>
    <pubDate>Thu, 06 Jul 2006 02:10:25 GMT</pubDate>
    <dc:creator>Peter Gillis</dc:creator>
    <dc:date>2006-07-06T02:10:25Z</dc:date>
    <item>
      <title>edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989109#M421744</link>
      <description>Hi   ...   ux 11.11v1 op sys,  posix sh.&lt;BR /&gt;I need to change a heap of lines in a heap of scripts the changes are directory names.&lt;BR /&gt;eg /opt/CA/sche  needs to change to /opt/CA/Umja/sche  &lt;BR /&gt;I seeem to remember there is a way to make changes like this relatively quickly.  Does anyone know of a way?&lt;BR /&gt;&lt;BR /&gt;pleanty points around&lt;BR /&gt;thanks Maria&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Jul 2006 00:46:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989109#M421744</guid>
      <dc:creator>Peter Gillis</dc:creator>
      <dc:date>2006-07-06T00:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989110#M421745</link>
      <description>&lt;!--!*#--&gt;Shalom Maria,&lt;BR /&gt;&lt;BR /&gt;The tool of choice is sed.&lt;BR /&gt;&lt;BR /&gt;Here is some sample code.&lt;BR /&gt;&lt;BR /&gt;The essense the sed s/search/replacewith/g command.&lt;BR /&gt;&lt;BR /&gt;So create a file list with fill path. Put it in a file called /tmp/filelist&lt;BR /&gt;&lt;BR /&gt;while read -r $filename&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;  sed s/juf.org/juf.net/g ${filename} &amp;gt;   ${filename}.bck"&lt;BR /&gt;  mv ${filename}.bck ${filename}&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; /tmp/filelist&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Please test this out before using it in production. The slashes will require a slight upgrade of my basic code.&lt;BR /&gt;&lt;BR /&gt;SEP&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Jul 2006 00:54:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989110#M421745</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-07-06T00:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989111#M421746</link>
      <description>Backup all scripts that are to be changed.&lt;BR /&gt;&lt;BR /&gt;sed 's/\opt\/CA\/sche/\/opt\/CA\/Umja\/sche/g' your_scripts</description>
      <pubDate>Thu, 06 Jul 2006 00:56:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989111#M421746</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-07-06T00:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989112#M421747</link>
      <description>perl supports in-line change&lt;BR /&gt;&lt;BR /&gt;# perl -li -e's{/opt/CA/sche\b}{/opt/CA/Umja/sche}g' all the files you want changed&lt;BR /&gt;&lt;BR /&gt;Or, if you want to change all *files* recursively from a folder/directory&lt;BR /&gt;&lt;BR /&gt;# find dir -type f | xargs perl -li -e's{/opt/CA/sche\b}{/opt/CA/Umja/sche}g'&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Thu, 06 Jul 2006 01:24:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989112#M421747</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-07-06T01:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989113#M421748</link>
      <description>RAC procure...do either of your methods actually change all mention of /opt/CA/sche&lt;BR /&gt;to /opt/CA/sche/UM  inside all the files in the directory, including if the path name has further directories added on to it?&lt;BR /&gt;I am an absolute novice with perl and sed. (that's probably the most helpful piece of info I can give you!)&lt;BR /&gt;thanks&lt;BR /&gt;Maria.</description>
      <pubDate>Thu, 06 Jul 2006 02:10:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989113#M421748</guid>
      <dc:creator>Peter Gillis</dc:creator>
      <dc:date>2006-07-06T02:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989114#M421749</link>
      <description>In this case, perl is just like sed and awk, it's only capable to in-line change the files, so you do not need temproray files&lt;BR /&gt;&lt;BR /&gt;If you only need to change files in one single dir, and not in subdirs,&lt;BR /&gt;&lt;BR /&gt;# cd that_dir&lt;BR /&gt;# perl -li -e's{/opt/CA/sche\b}{/opt/CA/Umja/sche}g' *&lt;BR /&gt;&lt;BR /&gt;will change all files for you. All occurannces.&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Thu, 06 Jul 2006 02:33:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989114#M421749</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-07-06T02:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989115#M421750</link>
      <description>Hi,&lt;BR /&gt;I have not been able to get result with the perl command..but with the sed command - I been testing on one file only - I issue the command and the actual script that I want the changes to take place in, scrolls past with the necesary test changes. But, then, I issue the more command to view slowly the entire contents of the file and there are NO changes !!  What is happening?  do you know?&lt;BR /&gt;thyanks&lt;BR /&gt;Maria</description>
      <pubDate>Thu, 06 Jul 2006 08:57:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989115#M421750</guid>
      <dc:creator>Peter Gillis</dc:creator>
      <dc:date>2006-07-06T08:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989116#M421751</link>
      <description>Maria,&lt;BR /&gt;&lt;BR /&gt;sed command itself does not make the changes to the original file. When you run it, it gives you the changed output to the stdout which is your terminal.&lt;BR /&gt;&lt;BR /&gt;assuming you are using RAC's one-liner sed command, you can do this:&lt;BR /&gt;&lt;BR /&gt;cd /my/scripts/directory&lt;BR /&gt;for script in `ls`&lt;BR /&gt;do&lt;BR /&gt;cat ${script} | sed 's/\opt\/CA\/sche/\/opt\/CA\/Umja\/sche/g' &amp;gt; ${script}.new&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;this will generate a new file with .new appended to the original filename in the same directory, which will be the modified version.&lt;BR /&gt;&lt;BR /&gt;Hope this helps</description>
      <pubDate>Thu, 06 Jul 2006 09:12:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989116#M421751</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2006-07-06T09:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989117#M421752</link>
      <description>Maria,&lt;BR /&gt;&lt;BR /&gt;It sounds as though you're not redirecting the output from sed to a file, so it's being displayed on stdout.  Make sure to use this syntax:&lt;BR /&gt;&lt;BR /&gt;sed s/juf.org/juf.net/g file_in &amp;gt; file_out&lt;BR /&gt;&lt;BR /&gt;Then 'more file_out'.&lt;BR /&gt;&lt;BR /&gt;PCS</description>
      <pubDate>Thu, 06 Jul 2006 09:13:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989117#M421752</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-07-06T09:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989118#M421753</link>
      <description>The perl command I would use is &lt;BR /&gt;&lt;BR /&gt;perl -pi -e's|/opt/CA/sche\b|/opt/CA/Umja/sche|g' *&lt;BR /&gt;&lt;BR /&gt;And if you wanted to save an old copy &lt;BR /&gt;&lt;BR /&gt;perl -pi.old -e's|/opt/CA/sche\b|/opt/CA/Umja/sche|g' *</description>
      <pubDate>Thu, 06 Jul 2006 09:33:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989118#M421753</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2006-07-06T09:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989119#M421754</link>
      <description>oh btw that would be ran from the directory with all the files you want to change. hopefully that was obvious.</description>
      <pubDate>Thu, 06 Jul 2006 09:39:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989119#M421754</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2006-07-06T09:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989120#M421755</link>
      <description>Sorry for the confusion caused by my typoes!&lt;BR /&gt;&lt;BR /&gt;perl -li -e&lt;BR /&gt;&lt;BR /&gt;is wrong&lt;BR /&gt;&lt;BR /&gt;perl -pi -e&lt;BR /&gt;&lt;BR /&gt;is correct.&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Thu, 06 Jul 2006 09:49:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989120#M421755</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-07-06T09:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: edit script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989121#M421756</link>
      <description>Thankyou everyone!!!&lt;BR /&gt;Mel, I used your method and it worked well for me.  The only thing I altered was number of slashes in the command:&lt;BR /&gt;sed 's/\opt\/CA\/sche/\opt\/CA\/UnicenterUUJMA\/sche/g' maria  &lt;BR /&gt;I have learnt plenty tonight, thankyou.&lt;BR /&gt;Maria</description>
      <pubDate>Thu, 06 Jul 2006 10:50:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/edit-script/m-p/4989121#M421756</guid>
      <dc:creator>Peter Gillis</dc:creator>
      <dc:date>2006-07-06T10:50:00Z</dc:date>
    </item>
  </channel>
</rss>

