remove Null and other lines from text file. - 01/10/03 03:38 PM
I have a program I run from mirc that scans a list of IPS and records if they are online or not. The text file output looks liek this:
What I want to do is remove the three ,ines of blank space at the bottom, and the lines that are text so that I will have a text file with only IP addresses.
The reason I ask is that I then use this text file to have mirc open sockets, and identify the machines. I tried to skip the lines that have text or null but cant seem to.
when it gets to one of these lines (nto an IP address) mirc gives an error "sockopen 'insufficient parameters'". so either a way to remvoe these fom the text file (including Null lines) or a way to skip them when running the alias vercheck is what I need to accomplich. Thanks for any suggestions.
Code:
Searching Hosts v.1.2a Online Hosts listed below 10.0.0.2 10.0.0.5 10.0.0.12 Searching Complete
What I want to do is remove the three ,ines of blank space at the bottom, and the lines that are text so that I will have a text file with only IP addresses.
The reason I ask is that I then use this text file to have mirc open sockets, and identify the machines. I tried to skip the lines that have text or null but cant seem to.
Code:
alias vercheck { set %rs.tmp 1 sockclose rs.* echo *** Started Rechecking.. $lines(" $+ $scriptdirscan.txt") ips to recheck write " $+ $scriptdirscan_rechecked.txt" *** Started Rechecking.. $lines(" $+ $scriptdirscan.txt") ips to recheck while ( %rs.tmp <= $lines(" $+ $scriptdirscan.txt") ) { if (Searching isin $read(" $+ $scriptsdirscan.txt" , %rs.tmp )) || (Online isin $read(" $+ $scriptsdirscan.txt", %rs.tmp )) || ($null isin $read(" $+ $scriptsdirscan.txt", %rs.tmp )) { inc %rs.tmp } else { if ($sock(rs. $+ $read(" $+ $scriptsdirscan.txt", %rs.tmp ))) { sockclose $sockname } sockopen rs. $+ $read(" $+ $scriptdirscan.txt" , %rs.tmp ) $read(" $+ $scriptdirscan.txt" , %rs.tmp ) 135 inc %rs.tmp } } echo *** Finished... closing all socks.. this may take a while (log: scan_rechecked.txt) }
when it gets to one of these lines (nto an IP address) mirc gives an error "sockopen 'insufficient parameters'". so either a way to remvoe these fom the text file (including Null lines) or a way to skip them when running the alias vercheck is what I need to accomplich. Thanks for any suggestions.