Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-15-2017, 07:54 PM   #1
LQ Newbie
Registered: Jul 2012
Posts: 10

Rep: Reputation: Disabled
Question Output match to a file using wget within a script


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...

userabc@virtual-machine:~/scrap$ cat


while read -r 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...

Old 08-15-2017, 08:10 PM   #2
LQ Newbie
Registered: Jul 2012
Posts: 10

Original Poster
Rep: Reputation: Disabled
got it

was missing / at end of url after the variables


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
wget: download if file size does not match any file in folder Si14 Linux - Software 1 04-21-2013 07:00 AM
Standard script output to screen & -x option output to file BoBeau236 Programming 6 05-10-2011 08:43 AM
Script to download file using wget linuxnewbie82 Programming 6 02-14-2007 05:48 AM
how to specify the name of the wget output file datasink Linux - Networking 2 01-23-2007 08:39 PM
grep output on stdout and grep output to file don't match xnomad Linux - General 3 01-13-2007 05:56 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:56 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration