On 2/14/02 at 3:34 PM, Serge Caron <[EMAIL PROTECTED]> wrote:

> Linux people are usually more intelligent than I am. Your
> sed mask allows for stuff like ...etc and ../../../etc and
> all kinds of ganes that I prefer not to play :). Following
> your intervention, the original sed command now reads

...I just LOVE a good sed challenge :-)

>   sed -e "/^etc[[:space:]]*$/d" -e "/^[/]etc[[:space:]]*$/d" \
>     -e "/^[.][/]etc[[:space:]]*$/d" \
>     -e "/^etc[/]/d" -e "/^[/]etc[/]/d" -e "/^[.][/]etc[/]/d" \
>        ${pkg} > ${pkg}.light

First, with GNU sed:

sed -e '......' -e '......' -e '.......'

can be written as:

sed '....; .....; .....'

...also, it would appear that your matches are overlapping...  why
not:

sed '/\.*\/*etc/{
/^etc[ ^I]*$/d
/^\.\/etc[ ^I]*$/d
/^\/etc[ ^I]*$/d
/^etc\//d
/^\.\/etc\//d
/^\/etc\//d
}' $pkg > $pkg.light

The first line matches only those things that contain etc with any
number of periods and slashes (in that order) - which means you've
just ruled out a TON of things.  Should be faster - only one match...

Using \. instead of [.] will save you one '.' - and it is probably
faster to use a single character instead of a set.

You don't need curly brackets ${} unless it is unclear where the name
starts and ends.... so ${pkg} is unnecessary, as is ${pkg}.light
(period "stops" the name) - but ${pkg}light and ${pkg}2 are necessary
if you want <pkg>light and <pkg>2 for names...

> As a case in point, Bering does not have netstat, a
> fixture in this environment since the early LRP days. In
> the confined space of a floppy, Jacques Nilo decided
> something that made sense for his project and he can
> revisit his decision at any time. In the meanwhile, you
> have Bering to play with.

netstat was also removed from Oxygen a while back; I think Linux in
general has made plain that netstat / route / ifconfig are to be
considered "old" and one is to use "ip" instead.

Oxygen dumped all three when space got tight; they are available as
packages.
--
David Douthitt
UNIX Systems Administrator
HP-UX, Unixware, Linux
[EMAIL PROTECTED]

_______________________________________________
Leaf-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-devel

Reply via email to