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.

I have a list of terms, each on a new line.

I need to Google search each one.

I have been copy and pasting each term invidivually into a new tab, but I was wondering if there was a way to automate it.

What is the easiest way to open a new tab for each term and search in on Google?

(I am on OSX. If any browser has an easy solution, I don't mind using it, but prefer Chrome if it doesn't matter.)

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

First, save the following code to a file:

<html>
<head>
<title>MultiSearch</title>
<script>
function search()
{
    var queries = document.getElementsByTagName('textarea')[0].value.split(/[\r\n]/);
    for(var i = 0, j = queries.length; i < j; i++)
        if(queries[i])
            window.open('http://www.google.com/search?q=' + queries[i]);
}
</script>
</head>
<body>
<textarea style="height:90%;width:100%"></textarea>
<input type="button" value="Search" onclick="search()">
</body>
</html>

Now, open the file in your browser, paste the search terms (one per line) and click Search.

This should work in most browsers. 

share|improve this answer
    
Thank you very much, Dennis. –  bookcasey Jul 10 '12 at 13:48
add comment

commandlinefu provides 2 approaches:

$ for line in `cat $file`; do firefox -new-tab "$line" & 2>/dev/null; sleep 1; done

and the slightly shorter:

$ for /F %i in (url_list.txt) do Firefox.exe -new-tab "%i"

Now, you could either adjust those so that the Google search URL part is always appended (sorry, I can't do it right now), or prepare your text file in Notepad++, like so:

  1. Initial text file:
    enter image description here

  2. Replace beginning of each line:
    enter image description here

  3. Result of that:
    enter image description here

share|improve this answer
    
Thank you very much. I've prepared my file, but I'm confused how to choose a text file for the first script. –  bookcasey Jul 10 '12 at 13:31
    
Type file=/path/to/file.txt before the "for" line. –  Rhyuk Jul 10 '12 at 13:43
add comment

Well I dunno if this fit your needs but it definitively works for automation in Google Chrome. Open up a tab and search for your term, afterwards right click on the tab and select "Pin tab". Do that for all the rest of your searches.

Now everytime you open up your browser it will load all of your pinned tabs with the results of your search term.

share|improve this answer
    
Thanks, but what I'm looking to do is quickly open up all these tabs in the first place. :-) –  bookcasey Jul 10 '12 at 12:56
1  
@bookcasey: Do you understand that you only have to do it manually once to set it up and then thereafter it will do it automatically? –  martineau Jul 10 '12 at 15:39
    
@martineau I dont think so :-/ –  Rhyuk Jul 10 '12 at 17:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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