![]()
Linux, Unix, /etc/$ To set up this Linux system, do I really have to type long,
cryptic, frequently inconsistent and undocumented commands with
occasional long strings of hex digits?
# Yeah. You got a problem with that?
|
Sponsored links (requires javascript):
#!/bin/sed -f
# fix html generated by my m4 -> html macros
# strip leading blank lines
1,/^</{
/^$/d
}
# strip space between termination of markup tag and punctuation.
s/\(>\) *\([.,:;")][.,:;")]*\)/\1\2/g
# strip multiple blank lines, leaving only one
/^ *$/{
N
/^ *\n *$/D
}
# generate correct http urlencoding for special iso-8859-1 chars;
# and for tilde, per RFC 1738
# (note: they have already been converted to HTML-encoding by htmlize)
# (but do that conversion again as well, just in case)
# do it for links
/<[Aa] [Hh][Rr][Ee][Ff]=/{
s/\(".*\)á\(.*">\)/\1%E1\2/g
s/\(".*\)á\(.*"\)/\1%E1\2/g
s/\(".*\)é\(.*">\)/\1%E9\2/g
s/\(".*\)é\(.*"\)/\1%E9\2/g
s/\(".*\)í\(.*">\)/\1%ED\2/g
s/\(".*\)í\(.*"\)/\1%ED\2/g
s/\(".*\)ó\(.*">\)/\1%F3\2/g
s/\(".*\)ó\(.*"\)/\1%F3\2/g
s/\(".*\)ú\(.*">\)/\1%FA\2/g
s/\(".*\)ú\(.*"\)/\1%FA\2/g
s/\(".*\)Á\(.*">\)/\1%C1\2/g
s/\(".*\)Á\(.*"\)/\1%C1\2/g
s/\(".*\)É\(.*">\)/\1%C9\2/g
s/\(".*\)É\(.*"\)/\1%C9\2/g
s/\(".*\)Í\(.*">\)/\1%CD\2/g
s/\(".*\)Í\(.*"\)/\1%CD\2/g
s/\(".*\)Ó\(.*">\)/\1%D3\2/g
s/\(".*\)Ó\(.*"\)/\1%D3\2/g
s/\(".*\)Ú\(.*">\)/\1%DA\2/g
s/\(".*\)Ú\(.*"\)/\1%DA\2/g
s/~/%7E/g
}
# and for anchors
/<[Aa] [Nn][Aa][Mm][Ee]=/{
s/\(".*\)á\(.*">\)/\1%E1\2/g
s/\(".*\)á\(.*"\)/\1%E1\2/g
s/\(".*\)é\(.*">\)/\1%E9\2/g
s/\(".*\)é\(.*"\)/\1%E9\2/g
s/\(".*\)í\(.*">\)/\1%ED\2/g
s/\(".*\)í\(.*"\)/\1%ED\2/g
s/\(".*\)ó\(.*">\)/\1%F3\2/g
s/\(".*\)ó\(.*"\)/\1%F3\2/g
s/\(".*\)ú\(.*">\)/\1%FA\2/g
s/\(".*\)ú\(.*"\)/\1%FA\2/g
s/\(".*\)Á\(.*">\)/\1%C1\2/g
s/\(".*\)Á\(.*"\)/\1%C1\2/g
s/\(".*\)É\(.*">\)/\1%C9\2/g
s/\(".*\)É\(.*"\)/\1%C9\2/g
s/\(".*\)Í\(.*">\)/\1%CD\2/g
s/\(".*\)Í\(.*"\)/\1%CD\2/g
s/\(".*\)Ó\(.*">\)/\1%D3\2/g
s/\(".*\)Ó\(.*"\)/\1%D3\2/g
s/\(".*\)Ú\(.*">\)/\1%DA\2/g
s/\(".*\)Ú\(.*"\)/\1%DA\2/g
s/~/%7E/g
}
# don't know how exactly this is happening, but it is
s/html ">/html">/g
# grotesquely ugly work-around for the troubles that apostrophes cause
# in my weblog scripts
s/\'/'/g
s/\`/`/g
s/\'/'/g
# fix extra space between end of link and punctuation
s/<\/a> ,/<\/a>,/g
s/<\/a> \./<\/a>./g
s/<\/a> :/<\/a>:/g
s/<\/a> ;/<\/a>;/g