Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Summary:

I need to find out if any items in my list occur in a website. I could do it manually with ctrl+f, but it would take a long time.

Description

I have a text file with key words in this format:

word1
word4
word12
word24
...

I need to search text in a table on a website with this format:

RandomWord    version 1.3    ...
word1         version 1.3    ...
word2         version 2.6    ...
word5         version 1.1    ...
randomword    version 9.0    ...
word12        version 1.0    ...
...           ...            ...

If the above data was what I had, it would be nice to end up with this list:

word1
word12
share|improve this question

closed as too localized by Nifle, Indrek, Mokubai, Kez, Randolph West Sep 9 '12 at 16:31

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 2 down vote accepted

Note: this is not IE specific.

You could create a JS script like so and run it from the command line using "cscript.exe".

// Create object
var objXMLHTTP = new ActiveXObject("MSXML2.XMLHTTP")

// Get the web page - Change to your page!
objXMLHTTP.open("GET", "http://www.google.com/index.html", false);
objXMLHTTP.send()

// Your list of words
var words = ["word1", "word4", "word12", "word24"];

// Get line
if (objXMLHTTP.Status == 200) {
    // Simple regex. You can change this if needed
    var re = new RegExp("(" + words.join("|") + ")", "i");
    // Break file into lines
    var lines = objXMLHTTP.responseText.split("\n");
    // Go through each line
    for (var i = 0; i < lines.length; i++) {
        // If it's a match, print it
        if (lines[i].match(re)) {
        WScript.Echo(lines[i]);
        }
    }
}
share|improve this answer
    
Thanks for this answer. I can't use it, in this case, but I appreciate your effort. This particular website updates specific page elements without sending me to a new URL, so I need to physically click stuff before I get to the table. –  Jesse Sep 12 '12 at 11:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.