sed sed sed

sed sed sed

Post by gru.. » Thu, 04 Jul 2002 18:17:21



On solaris 9 - why are there multiple copies of sed installed.  One in /usr/ucb
owned by the SUNWscpu third party package, /usr/xpg4/bin/sed by SUNWxcu4, and
one in /usr/bin owned by SUNWcsu.  I've looked on other Sun machines not
maintained by me and the same versions of sed are in the same place owned by the
same packages.

Why the multiple copies?

 
 
 

sed sed sed

Post by Werner STEINMAN » Thu, 04 Jul 2002 19:13:31


: On solaris 9 - why are there multiple copies of sed installed.
: One in /usr/ucb
: owned by the SUNWscpu third party package, /usr/xpg4/bin/sed by SUNWxcu4,
: and one in /usr/bin owned by SUNWcsu.  I've looked on other Sun machines
: not maintained by me and the same versions of sed are in the same place
: owned by the same packages.

: Why the multiple copies?

/usr/ucb is part of SunOS 4.x compatibility to SunOS 5.x,
Solaris support for XPG4 is under /usr/xpg4/bin
and the standard Solaris programs are e.g. in /usr/bin
because
there are difference between various versions of programs ...

Werner Steinmann

 
 
 

sed sed sed

Post by Paul Flo » Fri, 05 Jul 2002 05:39:24


[snip]

Quote:>> Why the multiple copies?
>man sed should explain the different versions.  I think xpg4/bin/sed is
>a POSIX version.  /usr/ucb/sed is the BSD version.  /usr/bin/sed is the
>Solaris SVR4 version.

>Is this sort of thing new to you?  Solaris has had these versions of
>various utilities for some time.

Not to mention, you may also have /opt/sfw/bin/gsed.

A bientot
Paul
--
Paul Floyd                 http://paulf.free.fr (for what it's worth)
What happens if you have lead in your pants as well as lead in your pencil?

 
 
 

1. SED SED SED...

Post follow-ups to comp.unix.questions, please.


| Is this simple or what: I want to erase the last 4 lines of a
| thousand files with variable length (I want to do more than
| that but I have succeded in the rest). I have tried $-4,$ d
| in sed (and many MANY variants of this) but it wont do.
| I have ended up using $ d (which works!!!) four times, but
| this makes my scripts long and the procces four times slower!!!

sed has no idea when it has reached $-4 or $-3, only when it has reached $.

Suggestion #1 -- if it must be done with sed, here goes:

sed '1N
     2N
     N
     $d
     P
     D'

Under GNU sed and possibly under BSD sed, it will require a -n flag to
operate properly on files of three or fewer lines, but one wouldn't run it
on files that short anyway.  -n won't hurt under System V, but it isn't
necessary, and no implementation of sed should need -n for files of four
lines or more.

Suggestion #2 -- forget sed:

ed - file << \FOOF
$-3,$ d
w
q
FOOF

[$-4,$ d would delete the last FIVE lines.  Ranges are inclusive.]

Suggestion #3 -- some perl fan will write it in perl.

David W. Tamkin   Box 59297   Northtown Station, Illinois  60659-0297

2. oops / NFS

3. . 2 sed FAQs, sed exes, sed cetras; URLs

4. X & Chips F65530

5. (sed 1q ; sed 2q) : no output from 2nd 'sed'

6. Scanner ACER Vuego Scan Brisa 620S

7. . sed script dc greg ubben sed stud

8. How do I set mutiple domains with linux

9. to all sed hackers - joining lines with sed

10. better sed s/\ a/\ A/g | sed s/\ b/\ B/g | ...

11. aix 3.2 - see sed run, run sed run

12. another tough sed problem: sed dependency

13. String manipulation error & how to use sed in a sed command?