LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-08-2023, 04:26 AM   #1
littlebigman
Member
 
Registered: Aug 2008
Location: France
Posts: 660

Rep: Reputation: 35
Question [wget] Display output with "-i" option?


Hello,

For basic web crawling, I'd like to feed wget a list of URLs, and then massage the data with grep + sed.

It works fine with a single URL, but I get no output on the screen when calling it with a list of URLs (-i switch):

Code:
wget -i list.txt -qO - | grep -Poha "some_pattern" | sed -r "s@some_pattern@\1 \2@"
Is there a work-around?

Thank you.
 
Old 07-08-2023, 04:35 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
here you can find some ideas: https://stackoverflow.com/questions/...in-a-text-file
 
Old 07-08-2023, 05:12 AM   #3
lvm_
Member
 
Registered: Jul 2020
Posts: 961

Rep: Reputation: 340Reputation: 340Reputation: 340Reputation: 340
The correct syntax for redirecting to stdout is "wget -O -", not "wget -"
 
Old 07-08-2023, 05:14 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,333
Blog Entries: 3

Rep: Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730
Quote:
Originally Posted by littlebigman View Post
It works fine with a single URL, but I get no output on the screen when calling it with a list of URLs (-i switch):
You might also need to use the --unbuffered and --line-buffered options with sed and grep, though if you are dealing with HTML or XML you will need a proper parser instead. For simple stuff there is xmlstarlet and for more complex stuff there is Perl or Python.
 
Old 07-08-2023, 05:21 AM   #5
littlebigman
Member
 
Registered: Aug 2008
Location: France
Posts: 660

Original Poster
Rep: Reputation: 35
Thanks all.
 
  


Reply



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
No display, no bios option page after choosing nomodeset... option in grub andy36633 Linux - Kernel 7 01-14-2019 01:07 AM
How to resume an interrupted wget using wget.log? misterJ Linux - Software 2 06-19-2011 01:21 PM
Rotate display -- Option "Rotate" "CCW" Brad.Scalio@noaa.gov Linux - General 0 01-27-2009 05:32 AM
wget not working! but "man wget is" ??? wrapster Solaris / OpenSolaris 5 07-30-2008 03:00 AM
Help With Java Problem Please"""""""""""" suemcholan Linux - Newbie 1 04-02-2008 06:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:46 PM.

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