Hi,
I have a script that scraps a webpage for the match and then is suppose to output to a file.
When I execute it from shell - it works fine however when it is executed from within the script - it is blank...
Code:
userabc@virtual-machine:~/scrap$ cat test.sh
filename="$1"
url="http://www.some-web-address.com/info-"
while read -r line
do
name="$line"
echo "Name read from file - $name"
echo "URL: $url$name"
wget -qO- $url$name | hxnormalize -x | hxselect "ul" | lynx -stdin -dump -nolist | awk 'c-->0;/MATCHINGSTRING/{c=2}'
done < "$filename"
whereas if I execute the wget from shell it works fine:
wget -qO-
http://www.some-web-address/info-name | hxnormalize -x | hxselect "ul" | lynx -stdin -dump -nolist | awk 'c-->0;/MATCHINGSTRING/{c=2}' >> output.txt
I would really appreciate if someone could help me out here - been going at this since few hours now...
Thanks!