But Ed Morton doesn't like it and therefore no one can use it.
Just ask the fatheaded technocratic bully.
-----------------------------------------------------------------
USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec.
29, 2005 Compiled by Eric Pement - pemente[at]northpark[dot]edu
version 5.5
Latest version of this file (in English) is usually at:
http://sed.sourceforge.net/sed1line.txt
http://www.pement.org/sed/sed1line.txt
This file will also available in other languages:
Chinese - http://sed.sourceforge.net/sed1line_zh-CN.html
Czech - http://sed.sourceforge.net/sed1line_cz.html
Dutch - http://sed.sourceforge.net/sed1line_nl.html
French - http://sed.sourceforge.net/sed1line_fr.html
German - http://sed.sourceforge.net/sed1line_de.html
Italian - (pending)
Portuguese - http://sed.sourceforge.net/sed1line_pt-BR.html
Spanish - (pending)
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
# triple space a file
sed 'G;G'
# undo double-spacing (assumes even-numbered lines are always blank)
sed 'n;d'
# insert a blank line above every line which matches "regex"
sed '/regex/{x;p;x;}'
# insert a blank line below every line which matches "regex"
sed '/regex/G'
# insert a blank line above and below every line which matches "regex"
sed '/regex/{x;p;x;G;}'
NUMBERING:
# number each line of a file (simple left alignment). Using a tab (see
# note on '\t' at end of file) instead of space will preserve margins.
sed = filename | sed 'N;s/\n/\t/'
# number each line of a file (number on left, right-aligned)
sed = filename | sed 'N; s/^/ /; s/ *\(.\{6,\}\)\n/\1 /'
# number each line of file, but only print numbers if line is not blank
sed '/./=' filename | sed '/./N; s/\n/ /'
# count lines (emulates "wc -l")
sed -n '$='
TEXT CONVERSION AND SUBSTITUTION:
# IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format.
sed 's/.$//' # assumes that all lines end with CR/LF
sed 's/^M$//' # in bash/tcsh, press Ctrl-V then Ctrl-M
sed 's/\x0D$//' # works on ssed, gsed 3.02.80 or higher
# IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format.
sed "s/$/`echo -e \\\r`/" # command line under ksh
sed 's/$'"/`echo \\\r`/" # command line under bash
sed "s/$/`echo \\\r`/" # command line under zsh
sed 's/$/\r/' # gsed 3.02.80 or higher
# IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format.
sed "s/$//" # method 1
sed -n p # method 2
# IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format.
# Can only be done with UnxUtils sed, version 4.0.7 or higher. The
# UnxUtils version can be identified by the custom "--text" switch
# which appears when you use the "--help" switch. Otherwise, changing
# DOS newlines to Unix newlines cannot be done with sed in a DOS
# environment. Use "tr" instead.
sed "s/\r//" infile >outfile # UnxUtils sed v4.0.7 or higher
tr -d \r outfile # GNU tr version 1.22 or higher
# delete leading whitespace (spaces, tabs) from front of each line
# aligns all text flush left
sed 's/^[ \t]*//' # see note on '\t' at end of file
# delete trailing whitespace (spaces, tabs) from end of each line
sed 's/[ \t]*$//' # see note on '\t' at end of file
# delete BOTH leading and trailing whitespace from each line
sed 's/^[ \t]*//;s/[ \t]*$//'
# insert 5 blank spaces at beginning of each line (make page offset)
sed 's/^/ /'
# align all text flush right on a 79-column width
sed -e :a -e 's/^.\{1,78\}$/ &/;ta' # set at 78 plus 1 space
# center all text in the middle of 79-column width. In method 1,
# spaces at the beginning of the line are significant, and trailing
# spaces are appended at the end of the line. In method 2, spaces at
# the beginning of the line are discarded in centering the line, and
# no trailing spaces appear at the end of lines.
sed -e :a -e 's/^.\{1,77\}$/ & /;ta' # method 1
sed -e :a -e 's/^.\{1,77\}$/ &/;ta' -e 's/\( *\)\1/\1/' # method 2
# substitute (find and replace) "foo" with "bar" on each line
sed 's/foo/bar/' # replaces only 1st instance in a line
sed 's/foo/bar/4' # replaces only 4th instance in a line
sed 's/foo/bar/g' # replaces ALL instances in a line
sed 's/\(.*\)foo\(.*foo\)/\1bar\2/' # replace the next-to-last case
sed 's/\(.*\)foo/\1bar/' # replace only the last case
# substitute "foo" with "bar" ONLY for lines which contain "baz"
sed '/baz/s/foo/bar/g'
# substitute "foo" with "bar" EXCEPT for lines which contain "baz"
sed '/baz/!s/foo/bar/g'
# change "scarlet" or "ruby" or "puce" to "red"
sed 's/scarlet/red/g;s/ruby/red/g;s/puce/red/g' # most seds
gsed 's/scarlet\|ruby\|puce/red/g' # GNU sed only
# reverse order of lines (emulates "tac")
# bug/feature in HHsed v1.5 causes blank lines to be deleted
sed '1!G;h;$!d' # method 1
sed -n '1!G;h;$p' # method 2
# reverse each character on the line (emulates "rev")
sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'
# join pairs of lines side-by-side (like "paste")
sed '$!N;s/\n/ /'
# if a line ends with a backslash, append the next line to it
sed -e :a -e '/\\$/N; s/\\\n//; ta'
# if a line begins with an equal sign, append it to the previous line
# and replace the "=" with a single space
sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D'
# add commas to numeric strings, changing "1234567" to "1,234,567"
gsed ':a;s/\B[0-9]\{3\}\>/,&/;ta' # GNU sed
sed -e :a -e 's/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta' # other seds
# add commas to numbers with decimal points and minus signs (GNU sed)
gsed -r ':a;s/(^|[^0-9.])([0-9]+)([0-9]{3})/\1\2,\3/g;ta'
# add a blank line every 5 lines (after lines 5, 10, 15, 20, etc.)
gsed '0~5G' # GNU sed only
sed 'n;n;n;n;G;' # other seds
SELECTIVE PRINTING OF CERTAIN LINES:
# print first 10 lines of file (emulates behavior of "head")
sed 10q
# print first line of file (emulates "head -1")
sed q
# print the last 10 lines of a file (emulates "tail")
sed -e :a -e '$q;N;11,$D;ba'
# print the last 2 lines of a file (emulates "tail -2")
sed '$!N;$!D'
# print the last line of a file (emulates "tail -1")
sed '$!d' # method 1
sed -n '$p' # method 2
# print the next-to-the-last line of a file
sed -e '$!{h;d;}' -e x # for 1-line files, print blank line
sed -e '1{$q;}' -e '$!{h;d;}' -e x # for 1-line files, print the line
sed -e '1{$d;}' -e '$!{h;d;}' -e x # for 1-line files, print nothing
# print only lines which match regular expression (emulates "grep")
sed -n '/regexp/p' # method 1
sed '/regexp/!d' # method 2
# print only lines which do NOT match regexp (emulates "grep -v")
sed -n '/regexp/!p' # method 1, corresponds to above
sed '/regexp/d' # method 2, simpler syntax
# print the line immediately before a regexp, but not the line
# containing the regexp
sed -n '/regexp/{g;1!p;};h'
# print the line immediately after a regexp, but not the line
# containing the regexp
sed -n '/regexp/{n;p;}'
# print 1 line of context before and after regexp, with line number
# indicating where the regexp occurred (similar to "grep -A1 -B1")
sed -n -e '/regexp/{=;x;1!p;g;$!N;p;D;}' -e h
# grep for AAA and BBB and CCC (in any order)
sed '/AAA/!d; /BBB/!d; /CCC/!d'
# grep for AAA and BBB and CCC (in that order)
sed '/AAA.*BBB.*CCC/!d'
# grep for AAA or BBB or CCC (emulates "egrep")
sed -e '/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d # most seds
gsed '/AAA\|BBB\|CCC/!d' # GNU sed only
# print paragraph if it contains AAA (blank lines separate paragraphs)
# HHsed v1.5 must insert a 'G;' after 'x;' in the next 3 scripts below
sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;'
# print paragraph if it contains AAA and BBB and CCC (in any order)
sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;/BBB/!d;/CCC/!d'
# print paragraph if it contains AAA or BBB or CCC
sed -e '/./{H;$!d;}' -e 'x;/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d
gsed '/./{H;$!d;};x;/AAA\|BBB\|CCC/b;d' # GNU sed only
# print only lines of 65 characters or longer
sed -n '/^.\{65\}/p'
# print only lines of less than 65 characters
sed -n '/^.\{65\}/!p' # method 1, corresponds to above
sed '/^.\{65\}/d' # method 2, simpler syntax
# print section of file from regular expression to end of file
sed -n '/regexp/,$p'
# print section of file based on line numbers (lines 8-12, inclusive)
sed -n '8,12p' # method 1
sed '8,12!d' # method 2
# print line number 52
sed -n '52p' # method 1
sed '52!d' # method 2
sed '52q;d' # method 3, efficient on large files
# beginning at line 3, print every 7th line
gsed -n '3~7p' # GNU sed only
sed -n '3,${p;n;n;n;n;n;n;}' # other seds
# print section of file between two regular expressions (inclusive)
sed -n '/Iowa/,/Montana/p' # case sensitive
> Print all lines of FileID upto 1st line containing
sed '/string/q' FileID
> Print all lines of FileID from 1st line containing
> until eof
sed '/string/,$!d' FileID
> Print all lines of FileID from 1st line containing
> until 1st line containing [boundries inclusive]
sed '/string1/,$!d;/string2/q' FileID
SELECTIVE DELETION OF CERTAIN LINES:
# print all of file EXCEPT section between 2 regular expressions
sed '/Iowa/,/Montana/d'
# delete duplicate, consecutive lines from a file (emulates "uniq").
# First line in a set of duplicate lines is kept, rest are deleted.
sed '$!N; /^\(.*\)\n\1$/!P; D'
# delete duplicate, nonconsecutive lines from a file. Beware not to
# overflow the buffer size of the hold space, or else use GNU sed.
sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'
# delete all lines except duplicate lines (emulates "uniq -d").
sed '$!N; s/^\(.*\)\n\1$/\1/; t; D'
# delete the first 10 lines of a file
sed '1,10d'
# delete the last line of a file
sed '$d'
# delete the last 2 lines of a file
sed 'N;$!P;$!D;$d'
# delete the last 10 lines of a file
sed -e :a -e '$d;N;2,10ba' -e 'P;D' # method 1
sed -n -e :a -e '1,10!{P;N;D;};N;ba' # method 2
# delete every 8th line
gsed '0~8d' # GNU sed only
sed 'n;n;n;n;n;n;n;d;' # other seds
# delete lines matching pattern
sed '/pattern/d'
# delete ALL blank lines from a file (same as "grep '.' ")
sed '/^$/d' # method 1
sed '/./!d' # method 2
# delete all CONSECUTIVE blank lines from file except the first; also
# deletes all blank lines from top and end of file (emulates "cat -s")
sed '/./,/^$/!d' # method 1, allows 0 blanks at top, 1 at EOF
sed '/^$/N;/\n$/D' # method 2, allows 1 blank at top, 0 at EOF
# delete all CONSECUTIVE blank lines from file except the first 2:
sed '/^$/N;/\n$/N;//D'
# delete all leading blank lines at top of file
sed '/./,$!d'
# delete all trailing blank lines at end of file
sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' # works on all seds
sed -e :a -e '/^\n*$/N;/\n$/ba' # ditto, except for gsed 3.02.*
# delete the last line of each paragraph
sed -n '/^$/{p;h;};/./{x;/./p;}'
SPECIAL APPLICATIONS:
# remove nroff overstrikes (char, backspace) from man pages. The 'echo'
# command may need an -e switch if you use Unix System V or bash shell.
sed "s/.`echo \\\b`//g" # double quotes required for Unix environment
sed 's/.^H//g' # in bash/tcsh, press Ctrl-V and then Ctrl-H
sed 's/.\x08//g' # hex expression for sed 1.5, GNU sed, ssed
# get Usenet/e-mail message header
sed '/^$/q' # deletes everything after first blank line
# get Usenet/e-mail message body
sed '1,/^$/d' # deletes everything up to first blank line
# get Subject header, but remove initial "Subject: " portion
sed '/^Subject: */!d; s///;q'
# get return address header
sed '/^Reply-To:/q; /^From:/h; /./d;g;q'
# parse out the address proper. Pulls out the e-mail address by itself
# from the 1-line return address header (see preceding script)
sed 's/ *(.*)//; s/>.*//; s/.*[:<] *//'
# add a leading angle bracket and space to each line (quote a message)
sed 's/^/> /'
# delete leading angle bracket & space from each line (unquote
a message)
sed 's/^> //'
# remove most HTML tags (accommodates multiple-line tags)
sed -e :a -e 's/<[^>]*>//g;/</N;//ba'
# extract multi-part uuencoded binaries, removing extraneous header
# info, so that only the uuencoded portion remains. Files passed to
# sed must be passed in the proper order. Version 1 can be entered
# from the command line; version 2 can be made into an executable
# Unix shell script. (Modified from a script by Rahul Dhesi.)
sed '/^end/,/^begin/d' file1 file2 ... fileX | uudecode # vers. 1
sed '/^end/,/^begin/d' "$@" | uudecode # vers. 2
# sort paragraphs of file alphabetically. Paragraphs are
separated by blank
# lines. GNU sed uses \v for vertical tab, or any unique char will do.
sed '/./{H;d;};x;s/\n/={NL}=/g' file | sort | sed '1s/={NL}=//;s/={NL}=/\n/g'
gsed '/./{H;d};x;y/\n/\v/' file | sort | sed '1s/\v//;y/\v/\n/'
# zip up each .TXT file individually, deleting the source file and
# setting the name of each .ZIP file to the basename of the .TXT file
# (under DOS: the "dir /b" switch returns bare filenames in all caps).
echo @echo off >zipup.bat
dir /b *.txt | sed "s/^\(.*\)\.TXT/pkzip -mo \1 \1.TXT/" >>zipup.bat
TYPICAL USE: Sed takes one or more editing commands and applies all of
them, in sequence, to each line of input. After all the commands have
been applied to the first input line, that line is output and a second
input line is taken for processing, and the cycle repeats. The
preceding examples assume that input comes from the standard input
device (i.e, the console, normally this will be piped input). One or
more filenames can be appended to the command line if the input does
not come from stdin. Output is sent to stdout (the screen). Thus:
cat filename | sed '10q' # uses piped input
sed '10q' filename # same effect, avoids a useless "cat"
sed '10q' filename > newfile # redirects output to disk
For additional syntax instructions, including the way to apply editing
commands from a disk file instead of the command line, consult "sed &
awk, 2nd Edition," by Dale Dougherty and Arnold Robbins (O'Reilly,
1997; http://www.ora.com), "UNIX Text Processing," by Dale Dougherty
and Tim O'Reilly (Hayden Books, 1987) or the tutorials by Mike Arst
distributed in U-SEDIT2.ZIP (many sites). To fully exploit the power
of sed, one must understand "regular expressions." For this, see
"Mastering Regular Expressions" by Jeffrey Friedl (O'Reilly, 1997).
The manual ("man") pages on Unix systems may be helpful (try "man
sed", "man regexp", or the subsection on regular expressions in "man
ed"), but man pages are notoriously difficult. They are not written to
teach sed use or regexps to first-time users, but as a reference text
for those already acquainted with these tools.
QUOTING SYNTAX: The preceding examples use single quotes ('...')
instead of double quotes ("...") to enclose editing commands, since
sed is typically used on a Unix platform. Single quotes prevent the
Unix shell from intrepreting the dollar sign ($) and backquotes
(`...`), which are expanded by the shell if they are enclosed in
double quotes. Users of the "csh" shell and derivatives will also need
to quote the exclamation mark (!) with the backslash (i.e., \!) to
properly run the examples listed above, even within single quotes.
Versions of sed written for DOS invariably require double quotes
("...") instead of single quotes to enclose editing commands.
USE OF '\t' IN SED SCRIPTS: For clarity in documentation, we have used
the expression '\t' to indicate a tab character (0x09) in the scripts.
However, most versions of sed do not recognize the '\t' abbreviation,
so when typing these scripts from the command line, you should press
the TAB key instead. '\t' is supported as a regular expression
metacharacter in awk, perl, and HHsed, sedmod, and GNU sed v3.02.80.
VERSIONS OF SED: Versions of sed do differ, and some slight syntax
variation is to be expected. In particular, most do not support the
use of labels (:name) or branch instructions (b,t) within editing
commands, except at the end of those commands. We have used the syntax
which will be portable to most users of sed, even though the popular
GNU versions of sed allow a more succinct syntax. When the reader sees
a fairly long command such as this:
sed -e '/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d
it is heartening to know that GNU sed will let you reduce it to:
sed '/AAA/b;/BBB/b;/CCC/b;d' # or even
sed '/AAA\|BBB\|CCC/b;d'
In addition, remember that while many versions of sed accept a command
like "/one/ s/RE1/RE2/", some do NOT allow "/one/! s/RE1/RE2/", which
contains space before the 's'. Omit the space when typing the command.
OPTIMIZING FOR SPEED: If execution speed needs to be increased (due to
large input files or slow processors or hard disks), substitution will
be executed more quickly if the "find" expression is specified before
giving the "s/.../.../" instruction. Thus:
sed 's/foo/bar/g' filename # standard replace command
sed '/foo/ s/foo/bar/g' filename # executes more quickly
sed '/foo/ s//bar/g' filename # shorthand sed syntax
On line selection or deletion in which you only need to output lines
from the first part of the file, a "quit" command (q) in the script
will drastically reduce processing time for large files. Thus:
sed -n '45,50p' filename # print line nos. 45-50 of a file
sed -n '51q;45,50p' filename # same, but executes much faster
If you have any additional scripts to contribute or if you find errors
in this document, please send e-mail to the compiler. Indicate the
version of sed you used, the operating system it was compiled for, and
the nature of the problem. To qualify as a one-liner, the command line
must be 65 characters or less. Various scripts in this file have been
written or contributed by:
Al Aab # founder of "seders" list
Edgar Allen # various
Yiorgos Adamopoulos # various
Dale Dougherty # author of "sed & awk"
Carlos Duarte # author of "do it with sed"
Eric Pement # author of this document
Ken Pizzini # author of GNU sed v3.02
S.G. Ravenhall # great de-html script
Greg Ubben # many contributions & much help
----------------------------------------------------------------------
Sid
[snipped ~475 lines of sed code]
You're spamming, spreading misinformation and nonsense, and
are off-topic here. Go away.
[fup2 set]
That's absurd.
> spreading misinformation and nonsense,
No I'm not.
Ed Morton throws a fit any time someone even mentions
sed on the comp.unix.shell group.
He's a headcase.
> and re off-topic here.
People post sed stuff on the awk group regularly.
They naturally go together. That's why the OREILLY
book is called "Sed & Awk"
> Go away.
How are you going to make me do that you lying asshole.
My suggestion for you is to eat shit.
>
> [fup2 set]
Sid
I see the troll is using this alias again. He has dozens
of them.
>> On Sun, 27 Sep 2009 02:16:33 +0200, Janis Papanagnou wrote:
>>
>>> You're spamming, spreading misinformation and nonsense, and
>>> are off-topic here. Go away.
>>
>> Anyone replying to Sidney just becomes his sex toy to play with at will.
>>
That's creepy.
>> Any response is just more fuel for the troll.
>>
>> Just kill file him.
Trolls never killfile anyone. You claim to have killfiled
me but are always responding to my articles under various names.
Nothing a loser like you can do can ever harm me, but you
aren't bright enough to figure that out after an entire
year of failures.
That's okay. It's your problem, not mine.
I just think you'd get tired of kissing my ass.
>
> Done. Thanks.
You needed a headsick troll to tell you about killfiling?
And you killfile people for posting a useful article full
of sed recipes and criticizing comp.lang.awk's resident
sed-hating neurotic?
You and he should both make appointments with therapists
in the near future.
Sid
This all started with this question being posted:
> I have a file that has a series of lists
>
> (qqq)
> aaa 111
> bbb 222
>
> and I want to make it look like
>
> aaa 111 (qqq)
> bbb 222 (qqq)
IMHO the clearest sed solution given was:
> sed -e '
> /^([^)]*)/{
> h; # remember the (qqq) part
> d
> }
>
> / [1-9][0-9]*$/{
> G; # strap the (qqq) part to the list
> s/\n/ /
> }
> ' yourfile
while the awk one was:
> awk '/^\(/{ h=$0;next } { print $0,h }' file
As I've said repeatedly, sed is an excellent tool for simple
substitutions on a single line. For anything else you should use awk,
perl, etc.
Having said that, let's take a look at the awk equivalents for the
posted sed examples below that are not simple substitutions on a single
line so people can judge for themselves (i.e. quietly - this is not a
contest and not a religious war!) which code is clearer, more
consistent, and more obvious. When reading this, just imagine yourself
having to figure out what the given script does in order to debug or
enhance it or write your own similar one later.
Note that in awk as in shell there are many ways to solve a problem so
I'm trying to stick to the solutions that I think would be the most
useful to a beginner since that's who'd be reading an examples page like
this, and without using any GNU awk extensions. Also note I didn't test
any of this but it's all pretty basic stuff so it should mostly be right.
For those who know absolutely nothing about awk, I think all you need to
know to understand the scripts below is that, like sed, it loops through
input files evaluating conditions against the current input record (a
line by default) and executing the actions you specify (printing the
current input record if none specified) if those conditions are true,
and it has the following pre-defined symbols:
NR = Number or Records read so far
NF = Number of Fields in current record
FS = the Field Separator
RS = the Record Separator
BEGIN = a pattern that's only true before processing any input
END = a pattern that's only true after processing all input.
Oh, and setting RS to the NULL string (-v RS='') tells awk to read
paragraphs instead of lines as individual records, and setting FS to the
NULL string (-v FS='') tells awk to treat each individual character as a
field.
For more info on awk, see http://www.awk.info.
<snip>
> FILE SPACING:
>
> # double space a file
> sed G
awk '{print $0 "\n"}'
> # double space a file which already has blank lines in it. Output file
> # should contain no more than one blank line between lines of text.
> sed '/^$/d;G'
awk 'NF{print $0 "\n"}'
> # triple space a file
> sed 'G;G'
awk '{print $0 "\n\n"}'
> # undo double-spacing (assumes even-numbered lines are always blank)
> sed 'n;d'
awk 'NF'
> # insert a blank line above every line which matches "regex"
> sed '/regex/{x;p;x;}'
awk '{print (/regex/ ? "\n" : "") $0}'
> # insert a blank line below every line which matches "regex"
> sed '/regex/G'
awk '{print $0 (/regex/ ? "\n" : "")}'
> # insert a blank line above and below every line which matches "regex"
> sed '/regex/{x;p;x;G;}'
awk '{print (/regex/ ? "\n" $0 "\n" : $0)}'
> NUMBERING:
>
> # number each line of a file (simple left alignment). Using a tab (see
> # note on '\t' at end of file) instead of space will preserve margins.
> sed = filename | sed 'N;s/\n/\t/'
awk '{print NR "\t" $0}'
> # number each line of a file (number on left, right-aligned)
> sed = filename | sed 'N; s/^/ /; s/ *\(.\{6,\}\)\n/\1 /'
awk '{printf "%6s %s\n",NR,$0}'
> # number each line of file, but only print numbers if line is not blank
> sed '/./=' filename | sed '/./N; s/\n/ /'
awk 'NF{print NR "\t" $0}'
> # count lines (emulates "wc -l")
> sed -n '$='
awk 'END{print NR}'
>
> TEXT CONVERSION AND SUBSTITUTION:
<simple substitutions on single line snipped>
> # align all text flush right on a 79-column width
> sed -e :a -e 's/^.\{1,78\}$/ &/;ta' # set at 78 plus 1 space
awk '{printf "%79s\n",$0}'
> # center all text in the middle of 79-column width. In method 1,
> # spaces at the beginning of the line are significant, and trailing
> # spaces are appended at the end of the line. In method 2, spaces at
> # the beginning of the line are discarded in centering the line, and
> # no trailing spaces appear at the end of lines.
> sed -e :a -e 's/^.\{1,77\}$/ & /;ta' # method 1
> sed -e :a -e 's/^.\{1,77\}$/ &/;ta' -e 's/\( *\)\1/\1/' # method 2
awk '{printf "%"int((79+length)/2)"s\n",$0}'
<simple substitutions on single line snipped>
> # reverse order of lines (emulates "tac")
> # bug/feature in HHsed v1.5 causes blank lines to be deleted
> sed '1!G;h;$!d' # method 1
> sed -n '1!G;h;$p' # method 2
awk '{a[NR]=$0} END{for (i=NR;i>=1;i--) print a[i]}'
> # reverse each character on the line (emulates "rev")
> sed '/\n/!G;s/\(.\)\(.*\n\)/&\2\1/;//D;s/.//'
awk -v FS='' '{for (i=NF;i>=1;i--) printf "%s",$i; print ""}'
> # join pairs of lines side-by-side (like "paste")
> sed '$!N;s/\n/ /'
awk '{printf "%s%s",$0,(NR%2 ? " " : "\n")}'
> # if a line ends with a backslash, append the next line to it
> sed -e :a -e '/\\$/N; s/\\\n//; ta'
awk '{printf "%s",(sub(/\\$/,"") ? $0 : $0 "\n")}'
> # if a line begins with an equal sign, append it to the previous line
> # and replace the "=" with a single space
> sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D'
awk '{printf "%s%s",(sub(/^=/," ") ? "" : "\n"),$0} END{print ""}'
<simple substitutions on single line snipped>
> # add a blank line every 5 lines (after lines 5, 10, 15, 20, etc.)
> gsed '0~5G' # GNU sed only
> sed 'n;n;n;n;G;' # other seds
awk '{print $0} !(NR%5){print ""}'
> SELECTIVE PRINTING OF CERTAIN LINES:
>
> # print first 10 lines of file (emulates behavior of "head")
> sed 10q
awk '{print $0} NR==10{exit}'
> # print first line of file (emulates "head -1")
> sed q
awk 'NR==1{print $0; exit}'
> # print the last 10 lines of a file (emulates "tail")
> sed -e :a -e '$q;N;11,$D;ba'
awk '{a[NR]=$0} END{for (i=NR-10;i<=NR;i++) print a[i]}'
> # print the last 2 lines of a file (emulates "tail -2")
> sed '$!N;$!D'
awk '{a[NR]=$0} END{for (i=NR-2;i<=NR;i++) print a[i]}'
> # print the last line of a file (emulates "tail -1")
> sed '$!d' # method 1
> sed -n '$p' # method 2
awk 'END{print $0}'
> # print the next-to-the-last line of a file
> sed -e '$!{h;d;}' -e x # for 1-line files, print blank line
> sed -e '1{$q;}' -e '$!{h;d;}' -e x # for 1-line files, print the line
> sed -e '1{$d;}' -e '$!{h;d;}' -e x # for 1-line files, print nothing
awk '{prev=curr; curr=$0} END{print prev}'
> # print only lines which match regular expression (emulates "grep")
> sed -n '/regexp/p' # method 1
> sed '/regexp/!d' # method 2
awk '/regexp/'
> # print only lines which do NOT match regexp (emulates "grep -v")
> sed -n '/regexp/!p' # method 1, corresponds to above
> sed '/regexp/d' # method 2, simpler syntax
awk '!/regexp/'
> # print the line immediately before a regexp, but not the line
> # containing the regexp
> sed -n '/regexp/{g;1!p;};h'
awk '/regexp/{print prev} {prev=$0}'
> # print the line immediately after a regexp, but not the line
> # containing the regexp
> sed -n '/regexp/{n;p;}'
awk 'found{print $0} {found=(/regexp/ ? 1 : 0)}'
> # print 1 line of context before and after regexp, with line number
> # indicating where the regexp occurred (similar to "grep -A1 -B1")
> sed -n -e '/regexp/{=;x;1!p;g;$!N;p;D;}' -e h
awk 'found {print preLine "\n" hitLine "\n" $0; found=0}
/regexp/ {preLine=prev; hitLine=NR " " $0; found=1}
{prev=$0}'
> # grep for AAA and BBB and CCC (in any order)
> sed '/AAA/!d; /BBB/!d; /CCC/!d'
awk '/AAA/&&/BBB/&&/CCC/'
> # grep for AAA and BBB and CCC (in that order)
> sed '/AAA.*BBB.*CCC/!d'
awk '/AAA.*BBB.*CCC/'
> # grep for AAA or BBB or CCC (emulates "egrep")
> sed -e '/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d # most seds
> gsed '/AAA\|BBB\|CCC/!d' # GNU sed only
awk '/AAA|BBB|CCC/'
> # print paragraph if it contains AAA (blank lines separate paragraphs)
> # HHsed v1.5 must insert a 'G;' after 'x;' in the next 3 scripts below
> sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;'
awk -v RS='' '/AAA/'
> # print paragraph if it contains AAA and BBB and CCC (in any order)
> sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;/BBB/!d;/CCC/!d'
awk -v RS='' '/AAA/&&/BBB/&&/CCC/'
> # print paragraph if it contains AAA or BBB or CCC
> sed -e '/./{H;$!d;}' -e 'x;/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d
> gsed '/./{H;$!d;};x;/AAA\|BBB\|CCC/b;d' # GNU sed only
awk -v RS='' '/AAA|BBB|CCC/'
> # print only lines of 65 characters or longer
> sed -n '/^.\{65\}/p'
awk -v FS='' 'NF>=65'
> # print only lines of less than 65 characters
> sed -n '/^.\{65\}/!p' # method 1, corresponds to above
> sed '/^.\{65\}/d' # method 2, simpler syntax
awk -v FS='' 'NF<65'
> # print section of file from regular expression to end of file
> sed -n '/regexp/,$p'
awk '/regexp/{found=1} found'
> # print section of file based on line numbers (lines 8-12, inclusive)
> sed -n '8,12p' # method 1
> sed '8,12!d' # method 2
awk 'NR>=8 && NR<=12'
> # print line number 52
> sed -n '52p' # method 1
> sed '52!d' # method 2
> sed '52q;d' # method 3, efficient on large files
awk 'NR==52{print $0; exit}'
> # beginning at line 3, print every 7th line
> gsed -n '3~7p' # GNU sed only
> sed -n '3,${p;n;n;n;n;n;n;}' # other seds
awk '!((NR-3)%7)'
> # print section of file between two regular expressions (inclusive)
> sed -n '/Iowa/,/Montana/p' # case sensitive
awk '/Iowa/,/Montana/'
>> Print all lines of FileID upto 1st line containing
>
> sed '/string/q' FileID
awk '{print $0} /string/{exit}'
>> Print all lines of FileID from 1st line containing
>> until eof
>
> sed '/string/,$!d' FileID
awk '/string/{found=1} found'
>> Print all lines of FileID from 1st line containing
>> until 1st line containing [boundries inclusive]
>
> sed '/string1/,$!d;/string2/q' FileID
awk '/string1/{found=1} found{print $0} /string2/{exit}'
> SELECTIVE DELETION OF CERTAIN LINES:
>
> # print all of file EXCEPT section between 2 regular expressions
> sed '/Iowa/,/Montana/d'
awk '/Iowa/,/Montana/{next} {print $0}' file
> # delete duplicate, consecutive lines from a file (emulates "uniq").
> # First line in a set of duplicate lines is kept, rest are deleted.
> sed '$!N; /^\(.*\)\n\1$/!P; D'
awk '$0!=prev{print $0} {prev=$0}'
> # delete duplicate, nonconsecutive lines from a file. Beware not to
> # overflow the buffer size of the hold space, or else use GNU sed.
> sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'
awk '!a[$0]++'
> # delete all lines except duplicate lines (emulates "uniq -d").
> sed '$!N; s/^\(.*\)\n\1$/\1/; t; D'
awk '$0==prev{print $0} {prev=$0}' # works only on consecutive
awk 'a[$0]++' # works on non-consecutive
> # delete the first 10 lines of a file
> sed '1,10d'
awk 'NR>10'
> # delete the last line of a file
> sed '$d'
awk 'NR>1{print prev} {prev=$0}'
> # delete the last 2 lines of a file
> sed 'N;$!P;$!D;$d'
awk 'NR>2{print prev[2]} {prev[2]=prev[1]; prev[1]=$0}' # method 1
awk '{a[NR]=$0} END{for (i=i;i<=NR-2;i++) print a[i]}' # method 2
awk -v num=2 'NR>num{print prev[num]}
{for (i=num;i>1;i--) prev[i]=prev[i-1]; prev[1]=$0}' # method 3
> # delete the last 10 lines of a file
> sed -e :a -e '$d;N;2,10ba' -e 'P;D' # method 1
> sed -n -e :a -e '1,10!{P;N;D;};N;ba' # method 2
awk -v num=10 '...same as deleting last 2 method 3 above...'
> # delete every 8th line
> gsed '0~8d' # GNU sed only
> sed 'n;n;n;n;n;n;n;d;' # other seds
awk 'NR%8'
> # delete lines matching pattern
> sed '/pattern/d'
awk '!/pattern/'
> # delete ALL blank lines from a file (same as "grep '.' ")
> sed '/^$/d' # method 1
> sed '/./!d' # method 2
awk '!/^$/' # method 1
awk '/./' # method 2
> # delete all CONSECUTIVE blank lines from file except the first; also
> # deletes all blank lines from top and end of file (emulates "cat -s")
> sed '/./,/^$/!d' # method 1, allows 0 blanks at top, 1 at EOF
awk '/./,/^$/'
> sed '/^$/N;/\n$/D' # method 2, allows 1 blank at top, 0 at EOF
no idea what the point of this is - I suspect someone just typed this by
accident when trying to solve a different problem and then noticed what
it does and decided to document it.
> # delete all CONSECUTIVE blank lines from file except the first 2:
> sed '/^$/N;/\n$/N;//D'
again, apparently pointless and would need some in/out to figure out
what it really means.
> # delete all leading blank lines at top of file
> sed '/./,$!d'
awk 'NF{found=1} found'
> # delete all trailing blank lines at end of file
> sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' # works on all seds
> sed -e :a -e '/^\n*$/N;/\n$/ba' # ditto, except for gsed 3.02.*
awk '{a[NR]=$0} NF{nbNr=NR} END{for (i=1;i<=nbNr;i++) print a[i]}'
> # delete the last line of each paragraph
> sed -n '/^$/{p;h;};/./{x;/./p;}'
awk -v FS='\n' -v RS='' '{for (i=1;i<=NF;i++) print $i; print ""}'
> SPECIAL APPLICATIONS:
<simple substitutions on single line snipped>
> # get Usenet/e-mail message header
> sed '/^$/q' # deletes everything after first blank line
awk '/^$/{exit}'
> # get Usenet/e-mail message body
> sed '1,/^$/d' # deletes everything up to first blank line
awk 'found{print $0} /^$/{found=1}'
> # get Subject header, but remove initial "Subject: " portion
> sed '/^Subject: */!d; s///;q'
awk 'sub(/Subject: */,"")'
> # get return address header
> sed '/^Reply-To:/q; /^From:/h; /./d;g;q'
can't tell from the comment what this specifically does to the text and
not worth the effort to figure out what the chains of hs, qs, gs and
semicolons mean.
> # parse out the address proper. Pulls out the e-mail address by itself
> # from the 1-line return address header (see preceding script)
> sed 's/ *(.*)//; s/>.*//; s/.*[:<] *//'
awk '{sub(/ *\(.*\)/,""); sub(/>.*/,""); sub(/.*[:<] */,""); print $0}'
> # add a leading angle bracket and space to each line (quote a message)
> sed 's/^/> /'
awk '{print "> " $0}'
> # delete leading angle bracket & space from each line (unquote
> a message)
> sed 's/^> //'
awk '{sub(/> /,""); print $0}'
> # remove most HTML tags (accommodates multiple-line tags)
> sed -e :a -e 's/<[^>]*>//g;/</N;//ba'
from here on down there was either not enough info in the description
and too many chains of single characters in the sed commands to easily
decipher, or we're getting into chains of sed piped to other commands,
or we're repeating examples that are already given above. There's enough
examples above to give a reasonable sed/awk language comparison anyway.
Ed.
very, very nice post. most informative.
t
On Sep 28, 10:10Â am, Ed Morton <mortons...@gmail.com> wrote
> -----------------------------------------------------------------
> USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor)
Oh look. Alan discovered google.
His technical skill is just so .... ****AWESOME***
> dear ed,
>
> very, very nice post. most informative.
Yes. It's a keeper!
Keep educating us.
Don't see why if the sed solutions work.
>
> Keep educating us.
A real education includes _all_ available options.
Ed Morton is an anti-sed wackjob and you should find
someone else to educate you on matters concerning
text manipulation.
There's no telling what other screwy prejudices he
has that will interfere with his rationality.
You'd know that if you weren't a dickless and stupid fucking
loser troll who keeps posting sophomoric shit on these
groups while hiding behind a score of aliases.
Sid
Meds.
Back.
On.
Now!
People who wander around the Usenet giving orders that they have
no power to enforce are the ones likely to be on medications.
I can see you wandering the streets telling the buildings to move
to different positions.
Sid
> As I've said repeatedly, sed is an excellent tool for simple
> substitutions on a single line. For anything else you should use awk,
I'd agree with that.
I'd also add it's actually good for an arbitrary number of simple
substitutions.
> perl, etc.
No need to get nasty :)
On a more serious note...
> Having said that, let's take a look at the awk equivalents for the
> posted sed examples below that are not simple substitutions on a single
> line so people can judge for themselves (i.e. quietly - this is not a
> contest and not a religious war!) which code is clearer, more
> consistent, and more obvious. When reading this, just imagine yourself
> having to figure out what the given script does in order to debug or
> enhance it or write your own similar one later.
I'd also like to add that for one-liners berevity over simplicity is
often important if you have memorized the trick, since it's often a
throwaway script.
The one main reason you can't use AWK where you can use sed is if you
require something more than regular expressions, eg:
sed -ne '/\(.*\)-\1/p'
I can count on the fingers of no hands the number of times I've
actually needed that construct. It's also not guaranteed to match in
polynomial time.
The other mildly aggravating thing is that it doesn't handle
references in substitution (which are regular and efficient). This is
the number one reason I use sed, for doing batch processing on files,
eg:
ls | sed -e's/\(.*\)png/convert & \1jpg/' | parallel 8
of course the awk version is usually a little longer:
awk -F. '{print "convert "$0" " " $1 ".jpg" }'
but for one-lines, I generally go for the least typing.
I also usually use GAWK which does have gensub.
You also missed the main use of SED programs of > 1 line:
http://sed.sourceforge.net/#gamez
-Ed
--
(You can't go wrong with psycho-rats.)(http://mi.eng.cam.ac.uk/~er258)
/d{def}def/f{/Times s selectfont}d/s{11}d/r{roll}d f 2/m{moveto}d -1
r 230 350 m 0 1 179{ 1 index show 88 rotate 4 mul 0 rmoveto}for/s 12
d f pop 235 420 translate 0 0 moveto 1 2 scale show showpage
Sounds good. Can you give an example? I'm not being facetious - I've
been using, and still do use, sed for 25 years on an almost daily basis
and I thought long and hard about what I use sed for before coming to
the realization that, after learning awk, I couldn't come up with
anything where it's easier to use sed than awk or head or tail or some
other UNIX tool that wasn't just a simple substitution on a single line.
That doesn't mean there aren't other uses, so I really would like to be
reminded if there are.
> The one main reason you can't use AWK where you can use sed is if you
> require something more than regular expressions, eg:
>
> sed -ne '/\(.*\)-\1/p'
Right, backreferences in an RE is a nice feature of sed that makes it
better than awk for simple substitutions on a single line like the above.
> I can count on the fingers of no hands the number of times I've
> actually needed that construct. It's also not guaranteed to match in
> polynomial time.
>
> The other mildly aggravating thing is that it doesn't handle
> references in substitution (which are regular and efficient). This is
> the number one reason I use sed, for doing batch processing on files,
> eg:
>
> ls | sed -e's/\(.*\)png/convert & \1jpg/' | parallel 8
>
> of course the awk version is usually a little longer:
>
> awk -F. '{print "convert "$0" " " $1 ".jpg" }'
That's not the awk equivalent as it'd produce unwanted results of the
filename contained a ".". The awk equivalent to that sed script would be:
awk '{new=$0; sub(/png/,"jpg",new); print "convert " $0 " " new}'
though both the sed and the awk script are wrong since you really want
to anchor the "png" with a trailing "$":
sed -e's/\(.*\)png$/convert & \1jpg/'
awk '{new=$0; sub(/png$/,"jpg",new); print "convert " $0 " " new}'
or the equivalent in GNU awk:
awk '{print gensub(/(.*)png$/,"convert & \\1jpg","")}'
or how I'd really write it in GNU awk:
awk '{print "convert",$0,gensub(/png$/,"jpg","")}'
>
> but for one-lines, I generally go for the least typing.
>
> I also usually use GAWK which does have gensub.
All of the above are simple substitutions on a single line which is
exactly what I'm saying sed is good for.
> You also missed the main use of SED programs of > 1 line:
I don't understand what that means. If you're saying I didn't refer to
that site that contains a lot of sed examples, well I didn't refer to
ANY site that contains sed examples so I didn't miss any. I just
provided awk equivalents to some posted sed scripts. I know there are
tons and tons of sites providing sed examples - I think that alone
speaks volumes.
Ed.
Preferably on top of YOU!
Geez, Alan, I have not read/posted on Usenet in a couple of years and I can
immediately smell you behind this crap as soon as I come back to it...
Kevin
> > I'd also like to add that for one-liners berevity over simplicity is
> > often important if you have memorized the trick, since it's often a
> > throwaway script.
>
> Sounds good. Can you give an example? I'm not being facetious - I've
> been using, and still do use, sed for 25 years on an almost daily basis
> and I thought long and hard about what I use sed for before coming to
> the realization that, after learning awk, I couldn't come up with
> anything where it's easier to use sed than awk or head or tail or some
> other UNIX tool that wasn't just a simple substitution on a single line.
> That doesn't mean there aren't other uses, so I really would like to be
> reminded if there are.
sure. I have a few examples.
batch processing is usually a little shorter in SED:
ls | sed -e's/\(.*\)png/convert & \1jpg/' | parallel 8
I also seem to remember having a task where the easy solution was
using sed with a script like:
s/foo/bar/
s/hello/world
for a few lines. But, I can't find it, so I can't remember what it was
for. I also wanted to modify a particular colour in an image. I have a
program which converts images in to a format suitable for AWK
processing. In this case, it was marginally shorter to do:
3,$s/255/0/
than the AWK equivalent. Usually in the cases where I use sed, the AWK
solution is only marginally longer.
> > The one main reason you can't use AWK where you can use sed is if you
> > require something more than regular expressions, eg:
>
> > sed -ne '/\(.*\)-\1/p'
>
> Right, backreferences in an RE is a nice feature of sed that makes it
> better than awk for simple substitutions on a single line like the above.
That's the main reason I use it, although, with backreferences in the
substitution, not the match.
> > ls | sed -e's/\(.*\)png/convert & \1jpg/' | parallel 8
>
> > of course the awk version is usually a little longer:
>
> > awk -F. '{print "convert "$0" " " $1 ".jpg" }'
>
> That's not the awk equivalent as it'd produce unwanted results of the
> filename contained a ".". The awk equivalent to that sed script would be:
>
> awk '{new=$0; sub(/png/,"jpg",new); print "convert " $0 " " new}'
>
> though both the sed and the awk script are wrong since you really want
> to anchor the "png" with a trailing "$":
>
> sed -e's/\(.*\)png$/convert & \1jpg/'
>
> awk '{new=$0; sub(/png$/,"jpg",new); print "convert " $0 " " new}'
>
> or the equivalent in GNU awk:
>
> awk '{print gensub(/(.*)png$/,"convert & \\1jpg","")}'
>
> or how I'd really write it in GNU awk:
>
> awk '{print "convert",$0,gensub(/png$/,"jpg","")}'
Good points. I'm normally rather lax since my filenames are well-
structured. I tend to choose names that make writing scripts easy. But
that's a nice example, the AWK script is a bit longer (and it's
missing some spaces in the output string).
> > You also missed the main use of SED programs of > 1 line:
>
> I don't understand what that means.
I was being light hearted. The SED scripts are an excellent
illustration of why you shouldn't write anything with more than one
line in SED, unless you particularly like a challenge.
Those are all still simple substitutions on a single line. Maybe it's
not clear what I mean by that - I mean substitutions that don't require
sed to match REs across lines of the input file or do anything else that
requires sed to know about more than one line of input at a time.
>>> The one main reason you can't use AWK where you can use sed is if you
>>> require something more than regular expressions, eg:
>>> sed -ne '/\(.*\)-\1/p'
>> Right, backreferences in an RE is a nice feature of sed that makes it
>> better than awk for simple substitutions on a single line like the above.
>
> That's the main reason I use it, although, with backreferences in the
> substitution, not the match.
Me too.
>
>>> ls | sed -e's/\(.*\)png/convert & \1jpg/' | parallel 8
>>> of course the awk version is usually a little longer:
>>> awk -F. '{print "convert "$0" " " $1 ".jpg" }'
>> That's not the awk equivalent as it'd produce unwanted results of the
>> filename contained a ".". The awk equivalent to that sed script would be:
>>
>> awk '{new=$0; sub(/png/,"jpg",new); print "convert " $0 " " new}'
>>
>> though both the sed and the awk script are wrong since you really want
>> to anchor the "png" with a trailing "$":
>>
>> sed -e's/\(.*\)png$/convert & \1jpg/'
>>
>> awk '{new=$0; sub(/png$/,"jpg",new); print "convert " $0 " " new}'
>>
>> or the equivalent in GNU awk:
>>
>> awk '{print gensub(/(.*)png$/,"convert & \\1jpg","")}'
>>
>> or how I'd really write it in GNU awk:
>>
>> awk '{print "convert",$0,gensub(/png$/,"jpg","")}'
>
> Good points. I'm normally rather lax since my filenames are well-
> structured. I tend to choose names that make writing scripts easy. But
> that's a nice example, the AWK script is a bit longer (and it's
> missing some spaces in the output string).
I don't think so. The commas produce FS characters which are spaces.
>>> You also missed the main use of SED programs of > 1 line:
>> I don't understand what that means.
>
> I was being light hearted. The SED scripts are an excellent
> illustration of why you shouldn't write anything with more than one
> line in SED, unless you particularly like a challenge.
Got it, thanks,
Ed.
Well, George, what you can do if you don't like what I have to
say is eat shit.
You obviously have no other option, being nothing but another
fat-assed, dickless sewer-mouthed punk hiding behind fake names
and the Internet.
You are boring.
Sid
Pot... Kettle... Black...
Kevin
Typical troll: The nimwit actually thinks I'm going to read
his sophomoric articles from now until eternity.
Yes. Morons can run computers. It's an amazing phenomenon.
He'll respond to this, too. And the poor feeb probably actually
believes I will be reading his articles.
Sid
> > Good points. I'm normally rather lax since my filenames are well-
> > structured. I tend to choose names that make writing scripts easy. But
> > that's a nice example, the AWK script is a bit longer (and it's
> > missing some spaces in the output string).
>
> I don't think so. The commas produce FS characters which are spaces.
Good point. I missed those.
Now I know you are nuts - you replied to your own post! Beauty, eh?
Kill-filed!
Kevin
Yep. The stinking troll actually believes I that I will continue
to read his juvenile articles forever.
They all do. It's part of their psychopathology.
"Kevin"?
I have dumped your last two articles.
You are no longer allowed to run your cunt mouth in my space.
If this bothers you, feel free to complain to your mommy.
It will work as well as anything else a dickless retard like
you coudld do.
No, I don't have to read your articles. Because you don't
know anyting worth knowing and are perfectly harmless.
Do feel free to jabber away for someone else's benefit. Gotta
be at least one retard paying attention here who is impressed
by losers like you.
Sid