<?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 Help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964628#M292173</link>
    <description>By log I mean anything that is *log*&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;hunki</description>
    <pubDate>Mon, 19 Mar 2007 13:05:14 GMT</pubDate>
    <dc:creator>Hunki</dc:creator>
    <dc:date>2007-03-19T13:05:14Z</dc:date>
    <item>
      <title>Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964626#M292171</link>
      <description>I need to change the email domain names on all the files on the system .&lt;BR /&gt;&lt;BR /&gt;Example : abc@xyz.com .. I need to change xyz.com to def.com for all the files on the system.( I need to avoid binaries and log files though )&lt;BR /&gt;&lt;BR /&gt;thanks,</description>
      <pubDate>Mon, 19 Mar 2007 12:39:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964626#M292171</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-03-19T12:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964627#M292172</link>
      <description>This would be fairly straightforward using Perl with File::Find and the -T filter or you could use find and then use the file command to identify "text" files (which will include scripts) but what is a log file? ie how do you identify log files. We can guess that they end with .log but that is a guess. Only you will know about any other log files.&lt;BR /&gt;Sed can then easily do the editing -- although I would do all of this in Perl.&lt;BR /&gt;&lt;BR /&gt;Learn to clearly define your problem and then the solutions become much more obvious.</description>
      <pubDate>Mon, 19 Mar 2007 13:01:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964627#M292172</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-19T13:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964628#M292173</link>
      <description>By log I mean anything that is *log*&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;hunki</description>
      <pubDate>Mon, 19 Mar 2007 13:05:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964628#M292173</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-03-19T13:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964629#M292174</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You could use the following pieces.  I assume that by "log" files you mean those ending with a ".log" extension, although this is easily changed:&lt;BR /&gt;&lt;BR /&gt;# perl -MFile::Find -le 'find(sub{print $File::Find::name if m/.+\.log/ &amp;amp;&amp;amp; -f $_ &amp;amp;&amp;amp; -T _}, @ARGV)' /path &amp;gt; filelist&lt;BR /&gt;&lt;BR /&gt;# perl -pi.old -e 's/abc\@xyz.com/def\@xyz.com/g' `cat filelist`&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 19 Mar 2007 13:09:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964629#M292174</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-19T13:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964630#M292175</link>
      <description>Hi JRF , &lt;BR /&gt;&lt;BR /&gt;the command is giving me all log files as output which I dont require. I want to search for all files containing "@abc.com" on the system except for log and binary files and then replace them with "@xyz.com" since the company domain name changed.&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;hunki</description>
      <pubDate>Mon, 19 Mar 2007 14:00:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964630#M292175</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-03-19T14:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964631#M292176</link>
      <description>Hi (again) Hunki:&lt;BR /&gt;&lt;BR /&gt;OK, I had it backwards.  To _skip_ files ending in ".log" negate (with '!') the condition.  Thus:&lt;BR /&gt;&lt;BR /&gt;# perl -MFile::Find -le 'find(sub{print $File::Find::name if ! m/.+\.log/ &amp;amp;&amp;amp; -f $_ &amp;amp;&amp;amp; -T _}, @ARGV)' /path &amp;gt; filelist&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Mar 2007 14:07:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964631#M292176</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-19T14:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964632#M292177</link>
      <description>this is not giving me the desired out ... can u explain what you are doing thru this perl command.</description>
      <pubDate>Mon, 19 Mar 2007 15:11:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964632#M292177</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-03-19T15:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964633#M292178</link>
      <description>Once again, you need to better define your problem. It is not clear what "out" is. Does that mean that the file list is incorrect? If so, how? --- OR --- does that mean that the files are not being modified correctly? If so, how?&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Mar 2007 15:15:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964633#M292178</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-19T15:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964634#M292179</link>
      <description>I mean the output that I am getting through the "##perl -MFile::Find -le 'find(sub{print $File::Find::name if ! m/.+\.log/ &amp;amp;&amp;amp; -f $_ &amp;amp;&amp;amp; -T _}, @ARGV)' /" command. The files that come in the output does not have "@xyz.com" in them.</description>
      <pubDate>Mon, 19 Mar 2007 15:19:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964634#M292179</guid>
      <dc:creator>Hunki</dc:creator>
      <dc:date>2007-03-19T15:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964635#M292180</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;I provided *two* Perl snippets.  The first simply gathers Ascii files while skipping files with ".log" in their name.&lt;BR /&gt;&lt;BR /&gt;I made NO PROVISION to filter any farther than that.&lt;BR /&gt;&lt;BR /&gt;The second Perl script does the actual replacement (if any) while preserving the original files as ".old".  It uses (as input) the output generated by the first script.&lt;BR /&gt;&lt;BR /&gt;Between the two, you have the hard work done for you.  You can filter (reduce) the output from the first step (e.g. with 'grep') or you can use it directly with the second script if it fits your needs.&lt;BR /&gt;&lt;BR /&gt;I didn't write a full-blown script but offered you re-useable pieces.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 19 Mar 2007 15:32:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964635#M292180</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-19T15:32:17Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964636#M292181</link>
      <description>The second perl script looks fine to me but you should note that there really is no "output" file because the editing is done on the original file. (well, that's almost correct but the net effect is that the original filename contains the updated data). The -i.old Perl option saves a copy of the original input with a .old suffix.</description>
      <pubDate>Mon, 19 Mar 2007 15:38:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964636#M292181</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-19T15:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Script Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964637#M292182</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;I might note that the second Perl script updates "in-place" while making a backup copy of the original file as "*.old".&lt;BR /&gt;&lt;BR /&gt;In the event that no matching patterns are found, the new file and the original would remain identical in content, although the 'mtime' of the current file would be changed to the current date/time since in truth it is a new file.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 19 Mar 2007 15:48:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3964637#M292182</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-19T15:48:46Z</dc:date>
    </item>
  </channel>
</rss>

