question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

... a simple POSIX /bin/sh script may be more simple solution then 15000 bytes python script ...

See original GitHub issue
#! /bin/sh

rm -f hosts.[0-9]*

cat << __EOF | while read LIST; do COUNT=$(( ${COUNT} + 1 )); echo "curl -g \"${LIST}\" | sed -e s/$'\r'//g 1> hosts.${COUNT}"; done | parallel
http://adaway.org/hosts.txt
http://netcologne.dl.sourceforge.net/project/adzhosts/FORADAWAY.txt
http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&mimetype=plaintext
http://someonewhocares.org/hosts/hosts
http://winhelp2002.mvps.org/hosts.txt
http://www.malwaredomainlist.com/hostslist/hosts.txt
https://raw.githubusercontent.com/StevenBlack/hosts/master/data/StevenBlack/hosts
__EOF

cat hosts.[0-9]* \
  | grep -v '^#' \
  | grep -v '^$' \
  | awk '{print $2}' \
  | sort -u -f \
  | while read I
    do
      echo 0.0.0.0 ${I}
    done | sed 1d 1> hosts


This one fetches all hosts sources in parallel and then merges them into a single 0.0.0.0 hosts file.

Regards, vermaden

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Rergiscommented, Jul 22, 2016

Suckless Philosophy in action! man i love this script!

0reactions
StevenBlackcommented, Jun 12, 2018

Closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running bash script from within python - Stack Overflow
Adding an answer because I was directed here after asking how to run a bash script from python. You receive an error OSError:...
Read more >
Classic SysAdmin: Writing a Simple Bash Script
This is a classic article written by Joe “Zonker” Brockmeier from the Linux.com archives. For more great SysAdmin tips and techniques check ...
Read more >
POSIX Shell Tutorial - The Grymoire!
How to build your own complex commands from the simple commands in ... A shell script can easily replace a C program, as...
Read more >
How can I get the size of a file in a bash script?
The script works on many Unix systems including Linux, BSD, OSX, Solaris, SunOS, etc. The file size shows the number of bytes. It...
Read more >
How do I pass the output of a python script to a shell variable?
You start your Python script from a shell script (or also from an interactive shell) and use command substitution. For POSIX shells (e.g....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found