diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-09-18 16:36:35 -0300 |
---|---|---|
committer | Silvio Rhatto <user@example.org> | 2014-09-18 16:36:35 -0300 |
commit | 0d9ff9ecbe486fa0efe89d079266f0d416d5067c (patch) | |
tree | b5389e2506ea3dfda3d26b44e362656e13c89d8a | |
download | sedscripts-0d9ff9ecbe486fa0efe89d079266f0d416d5067c.tar.gz sedscripts-0d9ff9ecbe486fa0efe89d079266f0d416d5067c.tar.bz2 |
Initial import
-rw-r--r-- | README.md | 0 | ||||
-rw-r--r-- | TODO.md | 0 | ||||
-rw-r--r-- | entities.sed | 24 | ||||
-rwxr-xr-x | justify.sed | 68 | ||||
-rw-r--r-- | mail-iso2txt.sed | 55 | ||||
-rw-r--r-- | mini-html2latex.sed | 9 | ||||
-rw-r--r-- | syndication.sed | 27 | ||||
-rwxr-xr-x | twiki-to-tiki.sed | 14 | ||||
-rw-r--r-- | unicode-zoado.sed | 11 | ||||
-rwxr-xr-x | wrap-forced.sed | 46 | ||||
-rw-r--r-- | yahoogroups-kill-sig.sed | 248 |
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/entities.sed b/entities.sed new file mode 100644 index 0000000..b2b4929 --- /dev/null +++ b/entities.sed @@ -0,0 +1,24 @@ +s/á/\á/g +s/ã/\ã/g +s/â/\â/g +s/à/\à/g +s/é/\é/g +s/ê/\ê/g +s/í/\í/g +s/ó/\ó/g +s/õ/\õ/g +s/ô/\ô/g +s/ú/\ú/g +s/ç/\ç/g +s/Á/\Á/g +s/Ã/\Ã/g +s/Â/\Â/g +s/É/\É/g +s/Ê/\Ê/g +s/Í/\Í/g +s/Ó/\Ó/g +s/Õ/\Õ/g +s/Ô/\Ô/g +s/Ú/\Ú/g +s/Ç/\Ç/g +s/ñ/\ñ/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/Â/\Â/g +s/â/\â/g +s/ã/\ã/g +s/é/\é/g +s/ô/\ô/g +s/á/\á/g +s/Ã/\Í/g +s/Ã/\í/g +s/ç/\ç/g +s/õ/\õ/g +s/ê/\ê/g +s/Ç/\Ç/g +s/Ã/\Ã/g +s/ó/\ó/g +s/ú/\ú/g +s/Ê/\Ê/g +s/É/\É/g +s/Ã/\Á/g +s/Ú/\Ú/g +s/á/\á/g +s/ê/\é/g +s/&aacute;/\á/g +s/&ecirc;/\ê/g +s/À/\À/g +s/–/\-/g +s/è/\è/g +s/Õ/\Õ/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/á/\á/g +s/Ã/\í/g +s/ó/\ó/g +s/ç/\ç/g +s/õ/\õ/g +s/ã/\ã/g +s/â/\â/g +s/é/\é/g +s/ê/\ê/g +s/ó/\ó/g +s/â/\â/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.*%%;} |