Operating System - HP-UX
1753878 Members
7105 Online
108809 Solutions
New Discussion юеВ

sed version ( HPUX , GNU)

 
SOLVED
Go to solution
Billa-User
Regular Advisor

sed version ( HPUX , GNU)

hello,

how can i find out the version of sed from HPUX (11.X) ? sed -V doesn't work , manpage also doesn't show a version
why i want the version of sed ? i am thinking now about the use of GNU "sed-4.1.5" because a colleague from the LINUX department showed me the option "sed -i". i think this a very good option.

do anybody have expierences of GNUD "sed" ?

in many scripts are commands like this:

sed -e "/^locks/s/ADMIN:/user:/p" \
< RCS,v \
> tempfile

if [ -s tempfile ]
then
rm -f RCS,v
mv tempfile RCS,v
fi

i had the problem, when i want to move the "tempfile" , it didn't exist in some special cases ... so i have to make a backup of the RCS,v file and when the move isn't ok , i have to try it again .

i think a good use of GNU "sed" ? or i have to correct the commands? or use other tools like "ed" ?

regards
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor
Solution

Re: sed version ( HPUX , GNU)

Hi:

As for the version of an HP-UX 'sed' you have to rely on comparisons with:

# what /usr/bin/sed

GNU 'sed' has inplace updating as you stated, obviating the need redirecting to a temporary file and then replacing the source file with the newly modified one.

Perl accomodates this:

# perl -pi.old -e 's/ADMIN:/user:/ if /^locks/' RCS,v

The '-i' switch enables inplace modification. The ".old" is an optional argument to it that causes a backup copy of the original file to be retained with the suffix of ".old" appended. If you don't want th backup, simply use '-i' alone.

Regards!

...JRF...
B. Hulst
Trusted Contributor

Re: sed version ( HPUX , GNU)

Use the command

strings /usr/bin/sed |grep version
Steven Schweda
Honored Contributor

Re: sed version ( HPUX , GNU)

> Use the command
>
> strings /usr/bin/sed |grep version

Did you try this, or were you guessing?
Around here:

dyi # strings /usr/bin/sed |grep version
dyi #

For some potentially useful info:

dyi # what /usr/bin/sed
/usr/bin/sed:
$Revision: B.11.31_LR

But I don't know what the actual value of
this is to you.

I can't recall ever needing to use GNU "sed",
but I'd expect it to be harmless.
Billa-User
Regular Advisor

Re: sed version ( HPUX , GNU)

hello,

steven: strings /usr/bin/sed |grep version
is a good trend to find out the version. but HPUX didn't show version , no problem.

i will use the perl solution. perl is now a standard product of HPUX. GNU "sed" looks good,but i have to install on many servers with different HPUX versions.

thanks to all
Billa-User
Regular Advisor

Re: sed version ( HPUX , GNU)

.
dirk dierickx
Honored Contributor

Re: sed version ( HPUX , GNU)

not sure you hpux sed has a real version number. it's one of those core unix tools, and it comes with the release of HPUX.

unlike linux where there is no tie between kernel & user land, and the tools develop regardless of what the kernel team is doing. it makes sense to have versions in GNU.

afaik bsd is the same story. the base user land tools come with a certain release of bsd and that is then basicly your 'version'.