--- /dev/null
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text" encoding="utf-8" />
+
+ <xsl:param name="break" select="'
'" />
+ <xsl:param name="quote" select="''" />
+ <xsl:param name="delim" select="'	'" />
+
+ <xsl:template match="/">
+ <xsl:apply-templates select="/*/*" />
+ </xsl:template>
+
+ <xsl:template match="/*/*">
+ <xsl:apply-templates />
+ <xsl:if test="following-sibling::*">
+ <xsl:value-of select="$break" />
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="*">
+ <!-- remove normalize-space() if you want keep white-space at it is -->
+ <xsl:value-of select="concat($quote, normalize-space(), $quote)" />
+ <xsl:if test="following-sibling::*">
+ <xsl:value-of select="$delim" />
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="text()" />
+</xsl:stylesheet>
--- /dev/null
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+@ARGV = ('/etc/services');
+while (<>) {
+ m,^(\w+)\s+(\d+)/(\w+)\s+#\s*(.*?)$, or next;
+ print join(qq|\t|,map(/^\s*(.*?)\s*$/,$2,$3,$1)).qq|\n|;
+}
}
data_src() {
- #pwd
-# NB 25.10.17 perl -ne 'm,^(\w+)\s+\d+/\w+\s+#\s*(.*?)$, and $_=join(qq|\t|,map(/^\s*(.*?)\s*$/,$1,$2)).qq|\n| and !$h{$_}++ and print' \
-# NB 25.10.17 /etc/services \
-# NB 25.10.17 > "$TMP/service.csv"
-# NB 25.10.17 csv2table service "$TMP/service.csv"
-
- perl -ne 'm,^(\w+)\s+(\d+)/(\w+)\s+#\s*(.*?)$, and print join(qq|\t|,map(/^\s*(.*?)\s*$/,$2,$3,$1)).qq|\n|' \
- /etc/services \
- > "$TMP/port.csv"
+ $DIR/port > "$TMP/port.csv"
csv2table port "$TMP/port.csv"
-# NB 25.10.17 html-table2csv https://www.ovh.co.uk/dedicated_servers/|perl -ne \
-# NB 25.10.17 '/^\w/ or next; @F=split("\t",$_);splice(@F,6,1); $F[6] =~s/ ex.*$//; $F[6] =~s/[^\d\.]//g; print $_ if $_=join("\t",map{$_ eq "-" ? "" : $_} @F[0..6])."\n" and !$dbl{$_}++' \
-# NB 25.10.17 > "$TMP/ovh_dedicated.csv"
-# NB 25.10.17 csv2table ovh_dedicated "$TMP/ovh_dedicated.csv"
-
- return 0
- w3m -dump -cols 999999 https://en.wikipedia.org/wiki/List_of_HTTP_status_codes| \
- perl -ne 'next unless /^\d\d\d / .. /^ /;s/.\[\d+\]//g; s/^ *//; s/^(\d+) ([\w _-]+).*?\n$/$1\t$2\t/;print' \
- > "$TMP/http_status.csv"
- csv2table http_status "$TMP/http_status.csv"
-
- curl -s http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml \
- > "$TMP/adservers.csv"
- csv2table adservers "$TMP/adservers.csv"
-
- curl -s 'http://www.user-agents.org/' | perl -e '$_=join(qq||,<>); print map {s/^\s*(.*?)(?:.nbsp.)?\s*$/$1/;qq|$_\n|} m,<td class=.right.>([^<]+),g'
- > "$TMP/useragent.csv"
- csv2table useragent "$TMP/useragent.csv"
-
}
(
(
-for f in $(grep -ErlI '^.{1,3}<SHELL_REPLACE' $NB_ROOT); do
+for f in $(shell_replace -find $NB_ROOT/*); do
echo "Update $f" | sed "s; $NB_ROOT/; ;"
shell_replace -i.shell_replace "$f"