#!/bin/sh curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts |\ perl -wnl -e ' if ( /^0\.0\.0\.0 (.*)$/ ) { print "local-zone: \"" . $1 . "\" redirect\nlocal-data: \"" . $1 . " A 0.0.0.0\""; } ' > ads.conf #### #!/bin/sh curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts |\ perl -wnl -e ' if ( /^0\.0\.0\.0/ ) { chomp; s/^0\.0\.0\.0 //; print "local-zone: \"" . $_ . "\" redirect\nlocal-data: \"" . $_ . " A 0.0.0.0\""; } ' > ads.conf #### #!/bin/sh curl https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts |\ perl -wnal -e ' if ( $F[0] eq "0.0.0.0" ) { print "local-zone: \"" . $F[1] . "\" redirect\nlocal-data: \"" . $F[1] . " A 0.0.0.0\""; } ' > ads.conf #### $ perl --help Usage: perl [switches] [--] [programfile] [arguments] ... -a autosplit mode with -n or -p (splits $_ into @F) -e program one line of program (several -e's allowed, omit programfile) -l[octal] enable line ending processing, specifies line terminator -n assume "while (<>) { ... }" loop around program -w enable many useful warnings ...