maart@cs.vu.nl (Maarten Litmaath) (06/13/89)
leo@philmds.UUCP (Leo de Wit) writes:
\...
\#! /bin/sed -f
\...
\ s/\(\n\)\([^ ][^ ][^ ][^ ][^ ]\) /\2 \1/
\...
\/......................................................................../!{
\...
Leo's sed `solution' makes 2 things clear:
1) sed ought to have C escape sequences like '\t'
2) sed ought to have some kind of `run' specifier
- quick: how many dots did Leo put on the `/<dots>/!{' line?
Ad 1: one should AVOID putting a HARD TAB in human-readable code, where using
the APPROPRIATE NUMBER OF SPACES would NOT have the SAME EFFECT.
Indentation: OK.
Example: in shell scripts use
tab=`ctrl I`
..."$tab"...
instead of
..." "...
--
"I HATE arbitrary limits, especially when |Maarten Litmaath @ VU Amsterdam:
they're small." (Stephen Savitzky) |maart@cs.vu.nl, mcvax!botter!maart
dce@Solbourne.COM (David Elliott) (06/13/89)
In article <2731@piraat.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >Leo's sed `solution' makes 2 things clear: > > 1) sed ought to have C escape sequences like '\t' > 2) sed ought to have some kind of `run' specifier > - quick: how many dots did Leo put on the `/<dots>/!{' line? 3) Leo has way too much free time. ;-) Seriously, it would be nice if sed had C escapes AND a way to specify whitespace. Often is the time when I type [ ][ ]* and wish I had a nice way to abbreviate whitespace. Also, doesn't System V have a way to do "runs"? I seem to recall something like following an re with {min,max}. -- David Elliott dce@Solbourne.COM ...!{boulder,nbires,sun}!stan!dce
leo@philmds.UUCP (Leo de Wit) (06/13/89)
In article <2731@piraat.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: [] |Ad 1: one should AVOID putting a HARD TAB in human-readable code, where using |the APPROPRIATE NUMBER OF SPACES would NOT have the SAME EFFECT. |Indentation: OK. |Example: in shell scripts use | | tab=`ctrl I` | ..."$tab"... | |instead of | | ..." "... Alas, it was a sed script, so I had no choice. Leo.
jeff@quark.WV.TEK.COM (Jeff Beadles) (06/14/89)
In article <1470@marvin.Solbourne.COM> dce@Solbourne.com (David Elliott) writes: >Seriously, it would be nice if sed had C escapes AND a way to specify >whitespace. Often is the time when I type > > [ ][ ]* > >and wish I had a nice way to abbreviate whitespace. I'd settle for extended regular expressions. (IE: [ ]+ ) Oh well, maybe if I get to be as bored as Leo :-) :-) -Jeff -- Jeff Beadles Utek Sustaining Engineering, Tektronix Inc. jeff@quark.WV.TEK.COM uunet!tektronix!quark.wv!jeff
decot@hpisod2.HP.COM (Dave Decot) (06/20/89)
|> [ ][ ]* |> |>and wish I had a nice way to abbreviate whitespace. | |I'd settle for extended regular expressions. (IE: [ ]+ ) POSIX P1003.2 will require that expressions of the form: [[:space:]][[:space:]]* be recognized, but that's probably not encouraging to you. At least there's no invisible tabs. I think \w would be helpful as an abbreviation for this, and also agree that + notation on basic regular expressions would be great. Dave
leo@philmds.UUCP (Leo de Wit) (07/22/89)
In article <3582@orca.WV.TEK.COM> jeff@quark.WV.TEK.COM (Jeff Beadles) writes: |In article <1470@marvin.Solbourne.COM> dce@Solbourne.com (David Elliott) writes: (The guy who tried to insinuate I was doing it in my free time 8-) |>Seriously, it would be nice if sed had C escapes AND a way to specify |>whitespace. Often is the time when I type |> |> [ ][ ]* |> |>and wish I had a nice way to abbreviate whitespace. | |I'd settle for extended regular expressions. (IE: [ ]+ ) | |Oh well, maybe if I get to be as bored as Leo :-) :-) Me? Not half as bored as the poster (and readers) of the n+1 (wrong) explanation of what 'grep' stands for, or how to reenter vi from ex, or ... If you care to take a look at the sed script, you might even learn some useful techniques. That cannot be said of every article that passes in this group. Leo.