Search Google from terminal and save output to a file


Are you thinking to search and query for google from terminal shell with bash script. And what if you want to redirect the output to a text file. You can do it with the following code.

This code also features zenity in order to save the output and query for what you are searching. This code is very productive and you can use it for many purposes.

Enjoy!


#!/bin/bash

squery=$(zenity --text)
file="/home/tushar/Desktop/search.txt"
(lynx "http://www.google.com/search?q=$(echo $squery|sed -e 's/+/%2B/g' -e 's/ /+/g')">$file) | zenity --progress \
--title="Quering for the provided tag in google" \
--text="Searching google ..... "\
--percentage=0
-- pulsate