aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-09-18 16:36:35 -0300
committerSilvio Rhatto <user@example.org>2014-09-18 16:36:35 -0300
commit0d9ff9ecbe486fa0efe89d079266f0d416d5067c (patch)
treeb5389e2506ea3dfda3d26b44e362656e13c89d8a
downloadsedscripts-0d9ff9ecbe486fa0efe89d079266f0d416d5067c.tar.gz
sedscripts-0d9ff9ecbe486fa0efe89d079266f0d416d5067c.tar.bz2
Initial import
-rw-r--r--README.md0
-rw-r--r--TODO.md0
-rw-r--r--entities.sed24
-rwxr-xr-xjustify.sed68
-rw-r--r--mail-iso2txt.sed55
-rw-r--r--mini-html2latex.sed9
-rw-r--r--syndication.sed27
-rwxr-xr-xtwiki-to-tiki.sed14
-rw-r--r--unicode-zoado.sed11
-rwxr-xr-xwrap-forced.sed46
-rw-r--r--yahoogroups-kill-sig.sed248
11 files changed, 502 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/README.md
diff --git a/TODO.md b/TODO.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TODO.md
diff --git a/entities.sed b/entities.sed
new file mode 100644
index 0000000..b2b4929
--- /dev/null
+++ b/entities.sed
@@ -0,0 +1,24 @@
+s/á/\&aacute;/g
+s/ã/\&atilde;/g
+s/â/\&acirc;/g
+s/à/\&agrave;/g
+s/é/\&eacute;/g
+s/ê/\&ecirc;/g
+s/í/\&iacute;/g
+s/ó/\&oacute;/g
+s/õ/\&otilde;/g
+s/ô/\&ocirc;/g
+s/ú/\&uacute;/g
+s/ç/\&ccedil;/g
+s/Á/\&Aacute;/g
+s/Ã/\&Atilde;/g
+s/Â/\&Acirc;/g
+s/É/\&Eacute;/g
+s/Ê/\&Ecirc;/g
+s/Í/\&Iacute;/g
+s/Ó/\&Oacute;/g
+s/Õ/\&Otilde;/g
+s/Ô/\&Ocirc;/g
+s/Ú/\&Uacute;/g
+s/Ç/\&Ccedil;/g
+s/ñ/\&ntilde;/g
diff --git a/justify.sed b/justify.sed
new file mode 100755
index 0000000..0a2e5af
--- /dev/null
+++ b/justify.sed
@@ -0,0 +1,68 @@
+#!/bin/sed -f
+# justify.sed - aurélio marinho jargas <verde (a) aurelio net>
+#
+# it gets a text already wrapped on the desired number of columns
+# and add extra white spaces, from left to right, word by word,
+# to justify all the lines. there is a maximum of 5 spaces to be
+# inserted between the words. if this limit is reached, the line
+# is not justified (come on, more than 5 is horrible). empty
+# lines are ignored. btw, this comments were justified with this
+# script &:)
+#
+# 20000715 1st release
+# 20000722 code cleaned
+
+# cleaning extra spaces of the line
+s/ \+/ /g
+s/^ //
+s/ $//
+
+# we'll only justify lines with less than 65 chars
+/^.\{65\}/b
+
+# backup of the 'stripped' line
+h
+
+# spaces -> pattern
+# convert series of spaces to a internal pattern `n
+:s2p
+s/ /`5/g
+s/ /`4/g
+s/ /`3/g
+s/ /`2/g
+s/ /`1/g
+t 1space
+b
+
+# pattern -> spaces
+# restore the spaces converted to the internal pattern `n
+:p2s
+s/`5/ /g
+s/`4/ /g
+s/`3/ /g
+s/`2/ /g
+s/`1/ /g
+t check
+b
+
+# check if we've reached our right limit
+# if not, continue adding spaces
+:check
+/^.\{65\}/!b s2p
+b
+
+# here's the "magic":
+# add 1 space to the first and minor internal pattern found.
+# this way, the extra spaces are always added from left to right,
+# always balanced, one by one.
+# right after the substitution, we'll restore the spaces and
+# test if our limit was reached.
+:1space
+s/`1/`2/ ; t p2s
+s/`2/`3/ ; t p2s
+s/`3/`4/ ; t p2s
+s/`4/`5/ ; t p2s
+
+# we don't want to justify with more than 5 added spaces between
+# words, so let's restore the original line
+/`5/x
diff --git a/mail-iso2txt.sed b/mail-iso2txt.sed
new file mode 100644
index 0000000..d3bf429
--- /dev/null
+++ b/mail-iso2txt.sed
@@ -0,0 +1,55 @@
+#!/bin/sed -f
+# mail-iso2txt.sed - 20000906 <verde (a) aurelio net>
+# convert the email encoded chars =xx to the right hexa char
+#
+# ps.: needs GNU sed >= 3.02.80 because the s//\xnn/ notation
+
+s|=09|\x09|g
+s|=20|\x20|g
+s|=B7|\xb7|g
+s|=BA|\xba|g
+s|=C1|\xc1|g
+s|=C2|\xc2|g
+s|=C3|\xc3|g
+s|=C4|\xc4|g
+s|=C5|\xc5|g
+s|=C6|\xc6|g
+s|=C7|\xc7|g
+s|=C8|\xc8|g
+s|=C9|\xc9|g
+s|=CA|\xca|g
+s|=CB|\xcb|g
+s|=CC|\xcc|g
+s|=CD|\xcd|g
+s|=CE|\xce|g
+s|=CF|\xcf|g
+s|=D7|\xd7|g
+s|=E1|\xe1|g
+s|=E2|\xe2|g
+s|=E3|\xe3|g
+s|=E4|\xe4|g
+s|=E5|\xe5|g
+s|=E6|\xe6|g
+s|=E7|\xe7|g
+s|=E8|\xe8|g
+s|=E9|\xe9|g
+s|=EA|\xea|g
+s|=EB|\xeb|g
+s|=EC|\xec|g
+s|=ED|\xed|g
+s|=EE|\xee|g
+s|=EF|\xef|g
+s|=F1|\xf1|g
+s|=F2|\xf2|g
+s|=F3|\xf3|g
+s|=F4|\xf4|g
+s|=F5|\xf5|g
+s|=F6|\xf6|g
+s|=F7|\xf7|g
+s|=F8|\xf8|g
+s|=F9|\xf9|g
+s|=FA|\xfa|g
+s|=FB|\xfb|g
+s|=FC|\xfc|g
+s|=$||g
+
diff --git a/mini-html2latex.sed b/mini-html2latex.sed
new file mode 100644
index 0000000..03fd2d5
--- /dev/null
+++ b/mini-html2latex.sed
@@ -0,0 +1,9 @@
+s/<strong>/\\section{/g
+s/<\/strong>/}/g
+s/<i>/\\emph{/g
+s/<\/i>/}/g
+s/<a href=\"/\\link{/g
+s/\">/}{/g
+s/<\/a>/}/g
+s/<pre>/\\begin{verbatim}/g
+s/<\/pre>/\\end{verbatim}/g
diff --git a/syndication.sed b/syndication.sed
new file mode 100644
index 0000000..4b6b195
--- /dev/null
+++ b/syndication.sed
@@ -0,0 +1,27 @@
+s/Â/\&#194;/g
+s/â/\&#226;/g
+s/ã/\&#227;/g
+s/é/\&#233;/g
+s/ô/\&#244;/g
+s/á/\&#225;/g
+s/Ã/\&#205;/g
+s/í/\&#237;/g
+s/ç/\&#231;/g
+s/õ/\&#245;/g
+s/ê/\&#234;/g
+s/Ç/\&#199;/g
+s/Ã/\&#195;/g
+s/ó/\&#243;/g
+s/ú/\&#250;/g
+s/Ê/\&#202;/g
+s/É/\&#201;/g
+s/Ã/\&#193;/g
+s/Ú/\&#218;/g
+s/á/\&#225;/g
+s/ê/\&#233;/g
+s/&amp;aacute;/\&#225;/g
+s/&amp;ecirc;/\&#234;/g
+s/À/\&#192;/g
+s/–/\-/g
+s/è/\&#232;/g
+s/Õ/\&#213;/g
diff --git a/twiki-to-tiki.sed b/twiki-to-tiki.sed
new file mode 100755
index 0000000..d0fe2f5
--- /dev/null
+++ b/twiki-to-tiki.sed
@@ -0,0 +1,14 @@
+#!/bin/sed -f
+#
+# twiki-to-tiki.sed: formatting conversion
+# feedback: rhatto@riseup.net
+#
+
+s/^ \*/\*/
+s/---+++/\!\!\!/
+s/---++/\!\!\!/
+s/---+/\!/
+s/\*\([A-Za-z0-9]*\)\*/__\1__/g
+s/<verbatim>/~pp\~/g
+s/<\/verbatim>/~\/pp\~/g
+s/%TOC%/{maketoc}/
diff --git a/unicode-zoado.sed b/unicode-zoado.sed
new file mode 100644
index 0000000..c372a71
--- /dev/null
+++ b/unicode-zoado.sed
@@ -0,0 +1,11 @@
+s/á/\&aacute;/g
+s/Ã/\&iacute;/g
+s/ó/\&oacute;/g
+s/ç/\&ccedil;/g
+s/õ/\&otilde;/g
+s/ã/\&atilde;/g
+s/â/\&acirc;/g
+s/é/\&eacute;/g
+s/ê/\&ecirc;/g
+s/ó/\&oacute;/g
+s/â/\&acirc;/g
diff --git a/wrap-forced.sed b/wrap-forced.sed
new file mode 100755
index 0000000..e7f2cc9
--- /dev/null
+++ b/wrap-forced.sed
@@ -0,0 +1,46 @@
+#!/bin/sed -f
+# wrap-forced.sed - wrap lines at column n
+#
+# acts like fmt, but ignores the 'word' context,
+# wrapping the line exactly at the specified column
+#
+# pt_BR comments:
+# funciona como o fmt, mas ignora o contexto de 'palavra'
+# quebrando a linha exatamente na coluna especificada
+#
+# c1: na primeira linha do texto...
+# c2: laço para colocar todas as linhas em 1 linha apenas
+# c3: isto é para eliminar espaços em branco repetidos
+# você pode comentá-lo se não quiser alterá-los
+# c4: dica: tire o espaço da 2ª parte do comando s para
+# apagar todos os espaços (parece arte ascii &:) )
+# c5: aqui é quem quebra a linha na coluna especificada
+# mude o 25 para o número que você quiser
+# o gnu-sed >= 3.02.80 é necessário por causa do \n
+#
+# 20000726 <verde (a) aurelio net>
+
+#c1: at the first line of the text...
+1{
+
+ #c2: loop to put all the lines of the text at one single line
+ :a
+ $!N
+ s/\n//
+ ta
+
+ #c3:
+ # this is to squeeze blanks
+ # you can comment it if you want blanks untouched
+ #c4:
+ # tip: take off the space at replacement part to have a result with
+ # NO spaces at all (looks like ascii art &:) )
+ s/[[:blank:]]\+/ /g
+
+ #c5:
+ # here is the guy who breaks the line at the specified column
+ # just change the 25 whatever column you like
+ # gnu-sed >= 3.02.80 required because the \n
+ s/.\{50\}/&\n/g
+}
+
diff --git a/yahoogroups-kill-sig.sed b/yahoogroups-kill-sig.sed
new file mode 100644
index 0000000..f7eb8c9
--- /dev/null
+++ b/yahoogroups-kill-sig.sed
@@ -0,0 +1,248 @@
+#!/bin/sed -f
+# yahoogroups-kill-sig.sed by Aurelio Marinho Jargas
+#
+# Erases the Yahoo! Groups e-mail signature ad
+#
+# CHANGELOG:
+# 20000??? v0.1 First one
+# 20000725 v0.2 Now it has BEGIN/END marks, it's easier!
+# 20000906 v0.3 Marks changed
+# 20001107 v0.3.1 Contrib: Schlemer HTML killer
+# ----- eGroups has changed to Yahoo! Groups -----
+# 20010206 v0.4 Contrib: Morcego's s/egroups/yahoo/s fix
+# 20010716 v0.5 Marks changed again
+# 20030428 v0.6 Policy Terms and Unsubscribe killers included
+# 20030506 v0.6.1 One-char fix on the Policy killer, added SAMPLE DATA
+#
+# DESCRIPTION:
+# Yahoogroups.com puts advertises on every sent message to the free groups.
+# This file is a sed filter to erase it. It handles quoted '> ' ads also.
+# If you do use procmail to filter e-mail messages, use this sed to
+# automaticaly remove the Ads for every message you receive.
+#
+# HOW TO USE:
+# Save this file on the disk and put at the begin of your ~/.procmailrc:
+# :0 fhw
+# * Delivered-To:.*@yahoogroups.com
+# | sed -f /path/to/yahoogroups-kill-sig.sed
+#
+# If preferred, make this file executable (chmod +x), put it in your PATH and:
+# :0 fhw
+# * Delivered-To:.*@yahoogroups.com
+# | yahoogroups-kill-sig.sed
+#
+#
+# SAMPLE DATA FILE:
+# You can use this sample data file to test these rules "by hand",
+# before including them on the procmail file.
+# Save the following fake e-mail message on a 'data.txt' file
+# (remove the leading # chars!) and run:
+#
+# prompt$ sed -f yahoogroups-kill-sig.sed data.txt
+#
+# All the Ads and Yahoo! messages should be removed.
+#
+#---------------------------8<---------------------------
+#From: foo@foo.com
+#To: foo@foo.com
+#Subject: test me
+#
+#Here's the message body.
+#And now, the evil sig.
+#
+#------------------------ Yahoo! Groups Sponsor ---------------------~-->
+#Secure your servers with 128-bit SSL encryption! Grab your copy of
+#VeriSign's FREE Guide "Securing Your Web Site for Business." Get it now!
+#http://www.verisign.com/cgi-bin/go.cgi?a=n094442340008000
+#http://us.click.yahoo.com/6lIgYB/IWxCAA/yigFAA/dkFolB/TM
+#---------------------------------------------------------------------~->
+#
+#Your use of Yahoo! Groups is subject to
+#http://docs.yahoo.com/info/terms/
+#
+#To unsubscribe from this group, send an email to:
+#foo-unsubscribe@yahoogroups.com
+#--------------------------->8---------------------------
+
+
+
+#-------------------------------------------------------------------------
+
+
+# +----+
+# | Ad |
+# +----+
+#
+# Ad details: * a line w/ 24 hifens, 'Yahoo...Sponsor', 21 hifens and '~-->'
+# * lines with yahoogroups propaganda
+# * a line with 69 hifens, and '~->' at the end
+# Ad Sample:
+# ------------------------ Yahoo! Groups Sponsor ---------------------~-->
+# Secure your servers with 128-bit SSL encryption! Grab your copy of
+# VeriSign's FREE Guide "Securing Your Web Site for Business." Get it now!
+# http://www.verisign.com/cgi-bin/go.cgi?a=n094442340008000
+# http://us.click.yahoo.com/6lIgYB/IWxCAA/yigFAA/dkFolB/TM
+# ---------------------------------------------------------------------~->
+#
+# Ad Killer:
+/^\(> \)*-\{24\} Yahoo! Groups Sponsor -\{21\}~-->$/,/^\(> \)*-\{69\}~->$/d
+
+
+#-------------------------------------------------------------------------
+
+
+# +--------+
+# | Policy |
+# +--------+
+#
+# You can also remove the Policy Terms message.
+#
+# Policy Details: A one line message, sometimes broken into two,
+# which appears at the very end of the message.
+# Policy Sample:
+# Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
+#
+# Policy Killer:
+/^\(> \)*Your use of Yahoo! Groups is subject to *$/N
+/^\(> \)*Your use of Yahoo! Groups is subject to/d
+
+
+#-------------------------------------------------------------------------
+
+
+# +-------------+
+# | Unsubscribe |
+# +-------------+
+#
+# This one is to remove the *default* unsubscribe footer.
+#
+# Unsubscribe Details: A one line message, sometimes broken into two,
+# which appears before the Ads.
+# Unsubscribe Sample:
+# To unsubscribe from this group, send an email to:
+# foo-unsubscribe@yahoogroups.com
+#
+# Unsubscribe Killer:
+/^\(> \)*To unsubscribe from this group, send an email to: *$/N
+/^\(> \)*To unsubscribe from this group, send an email to:/d
+
+
+#-------------------------------------------------------------------------
+
+
+# +---------+
+# | Ad HTML |
+# +---------+
+#
+# For those who receive the Yahoo! messages in HTML (argh!), you may use
+# this one also, because the HTML signature is way different.
+#
+# Ad Details: * an HTML comment with bar-star-star-bar,text,bar-star-star-bar
+# * lines with egroups propaganda
+# * an HTML comment with bar-star-star-bar,text,bar-star-star-bar
+# Ad Sample:
+# <!-- |**|begin egp html banner|**| -->
+#
+# <hr>
+# <!-- |@|begin eGroups banner|@| runid: 8193 crid: 4101 -->
+# <a target=3D"_blank"
+# href=3D"http://click.egroups.com/1/8193/8/_/134812/_/9=
+# 66089206/"><center>
+# <img width=3D"468" height=3D"60"
+# border=3D"0"
+# alt=3D""
+# src=3D"http://adimg.egroups.com/img/8193/8/_/134812/_/966089206/468x60_ma=
+# ze12k.gif"></center><center><font color=3D"black"></font></center></a>
+# <!-- |@|end eGroups banner|@| -->
+# <hr>
+#
+# <!-- |**|end egp html banner|**| -->
+#
+# Ad Killer:
+#/^\(> \)*<!-- |\*\*|begin egp html banner|\*\*| -->$/,/^\(> \)*<!-- |\*\*|end egp html banner|\*\*| -->$/d
+
+
+
+
+
+
+#-------------------------------------------------------------------------
+# +-------------+
+# | OLD KILLERS |
+# +-------------+
+#-------------------------------------------------------------------------
+#
+# +---------+
+# | Ad v0.4 |
+# +---------+
+#
+# Ad details: * a line w/ 24 hifens, 'Yahoo!...Sponsor', 21 hifens and '~-~>'
+# * lines with yahoogroups propaganda
+# * a line with 69 hifens, and '_->' at the end
+# Ad Sample:
+# ------------------------ Yahoo! Groups Sponsor ---------------------~-~>
+# eGroups is now Yahoo! Groups
+# Click here for more details
+# http://click.egroups.com/1/11231/1/_/161736/_/980877852/
+# ---------------------------------------------------------------------_->
+#
+# Ad Killer:
+#/^\(> \)*-\{24\} Yahoo! Groups Sponsor -\{21\}~-~>$/,/^\(> \)*-\{69\}_->$/d'
+#
+#-------------------------------------------------------------------------
+#
+# +---------+
+# | Ad v0.3 |
+# +---------+
+#
+# Ad details: * a line w/ 26 hifens, 'eGroups Sponsor', 25 hifens and '~-~>'
+# * lines with egroups propaganda
+# * a line with 69 hifens, and '_->' at the end
+#
+# Ad Sample:
+# -------------------------- eGroups Sponsor -------------------------~-~>
+# GET A NEXTCARD VISA, in 30 seconds! Get rates
+# of 2.9% Intro or 9.9% Ongoing APR* and no annual fee!
+# Apply NOW!
+# http://click.egroups.com/1/7872/14/_/_/_/967638075/
+# ---------------------------------------------------------------------_->
+#
+# Ad Killer:
+#/^\(> \)*-\{26\} eGroups Sponsor -\{25\}~-~>$/,/^\(> \)*-\{69\}_->$/d
+#
+#-------------------------------------------------------------------------
+#
+# +---------+
+# | Ad v0.2 |
+# +---------+
+#
+# Ad details: * a line with 68 hifens, an '<e|' and another hifen
+# * lines with egroups propaganda
+# * a line with 68 hifens, an '|e>' and another hifen
+# Ad Sample:
+# --------------------------------------------------------------------<e|-
+# Huge Shoe Selection at Zappos.com
+# (small sizes also available)
+# http://click.egroups.com/1/7062/5/_/193628/_/964577029/
+# --------------------------------------------------------------------|e>-
+#
+# Ad Killer:
+#/^\(> \)*-\{68\}<e|-$/,/^\(> \)*-\{68\}|e>-$/d
+#
+#-------------------------------------------------------------------------
+#
+# +---------+
+# | Ad v0.1 |
+# +---------+
+#
+# Ad Details: * a line with exactly 72 hifens before and after
+# * any number of lines between
+# * a line with 'http://click.egroups.com'
+# Ad Sample:
+# ------------------------------------------------------------------------
+# $60 in FREE Long Distance! Click Here to join beMANY! today.
+# http://click.egroups.com/1/4126/10/_/_/_/958599956/
+# ------------------------------------------------------------------------
+#
+# Ad Killer:
+#/^\(> \)*-\{72\}$/{N;:l;/-\{72\}$/bs;N;bl;:s;s%^.*\n\(> \)*http://click\.egroups\.com.*%%;}