Your holinesses. I have a system file with a case statement like this. I need to check and see if the entry 'bgs' is correct? This one is no +t. Most of them are not. I have several hundred files I need to change. Many don't have it. So, for this file I need to change: /sbin/sh /usr/adm/best1_default/bgs/scripts/best1agent_start>>$LOG 2>> +$LOG to: '/usr/bin/su - patrol /usr/adm/best1_default/bgs/scripts/best1agent -q +' Which is strait forward. I leave the ones that are ok alone. Change the ones that are wrong. Add the 3 lines if they are not there after a trigger of something lik +e 'cron'. 'bgs') '/usr/bin/su - patrol /usr/adm/best1_default/bgs/scripts/best1agent + -q' ;; I thought it would be easy. But, I'm having a hell of a time with it. + I've tryed several diferent ways. Logic: I'm not sure about? foreach through the files. open() and while() through each file. check for $line to see if it needs to be changed. If it does, Change it. If not leave it alone. BUT, what if it doesn't have the $line at all? I was thinking early on + in the script to use grep. But, I can't get that to work. Any suggestions would be much appreciated. FILE TO CHANGE: case "$process" in 'cron') /sbin/sh /etc/rc2.d/S75cron start >>$LOG 2>>$LOG ;; 'secmgrd') echo "Starting SECMGRD" >>$LOG /sbin/sh /etc/init.d/iv stop >>$LOG 2>>$LOG /sbin/sh /etc/init.d/iv start >>$LOG 2>>$LOG return ;; 'bgs') /sbin/sh /usr/adm/best1_default/bgs/scripts/best1agent_start>>$LOG +2>>$LOG ;; 'twagent') /sbin/sh /etc/rc2.d/S95twagent start>>$LOG 2>>$LOG ;; 'bvcontrold') /sbin/sh /etc/init.d/bvunix start>>$LOG 2>>$LOG ;; 'dsmcad') /sbin/sh /etc/init.d/adsm_sched>>$LOG 2>>$LOG ;; *) return ;; esac
Thank You

In reply to I need some pearls of wisdom by wcj75019

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.