I have determined that the person that had written this script was being inefficient. They were running a db2 command putting the output into a variable then writing the variable to a file then reading the file and writing its contents into another file. I have shortened up the code and made it a little cleaner. I have gotten rid of the sed stuff completely and when I run it it does not give me any error message at all. Thank you to all of you for replying. Here is the snippet that I have changed:
OLD:
$bkp = `db2 "list history backup all for $db " |tail -6`;
open TEMP, ">$temp";
print TEMP $bkp;
close TEMP;
print FILE "\nBackup Information:\n";
$bkp_info = `sed -e :a -e "{$d;N;2,3ba}" -e "{P;D}" /db2/$DB2DBDFT/Mes
+sages/temp.txt`;
if($bkp_info =~ /Start/)
{
print FILE $bkp_info;
}
NEW:
$bkp = `db2 "list history backup all for $db " |tail -6`;
print FILE "\nBackup Information:\n";
if($bkp =~ /Start/)
{
print FILE $bkp;
}
This new code saves 4 lines and doesn't give errors and the output via the email is still the same so I have no idea what the original programmer was doing with the sed command.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.