I have a wget
script named Chktitle.sh
-- this script takes a command like below
$ Chktitle.sh "my url"
I then have a file name url.txt
with over 100 lines with urls and ips to check for web-page titles.
Then i have results.txt
as a blank file.
Is there any way I can perform a repetitive action like below for each line in the file:
Grab line1 from url.txt
-----
then execute Chktitle.sh "line1"
-----
Now save the result for line1 in results.txt
-----
Now goto Line2 ........
etc etc etc
I need to make sure that it will only execute the next line after the previous one has finished.
Can any one show me any easy way to perform this? I am happy to use Perl, sh, and consider other languages..
The contents of chktitle.sh
:
#!/bin/bash
string=$1"/search/"
wget --quiet -O - $string
| sed -n -e 's!.*<title>(.*)</title>.*!1!p'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…