About | Home | Search


HOWTO: sed
Description: GNU stream editor
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# GNU sed 4.1.5
# =============
# Slackware 9.0's 'sed' package includes version 4.0.5, 9.1's includes 3.02
# The Slack ChangeLog lists the downgrade as due to "serious performance and
# regex bugs".  Slackware 10.0, 10.1, and 10.2 include version 4.0.9

# I have not tried it, but there is another branch of sed called super-sed:
# http://sed.sourceforge.net/grabbag/ssed/

# If ftp.gnu.org is busy, try ibiblio instead

# Prerequisites:
# gawk
# grep
# texinfo (makeinfo is used to build HTML documentation)
# libiconv
# bison

cd
test -f installed/sed-4.1.5.tar.gz && mv installed/sed-4.1.5.tar.gz .
test ! -f sed-4.1.5.tar.gz &&
 wget http://ftp.gnu.org/gnu/sed/sed-4.1.5.tar.gz

# Verify tarball w/ md5sum:
# (this came from my gpg verified tarball)
echo "7a1cbbbb3341287308e140bd4834c3ba  sed-4.1.5.tar.gz" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg verified tarball)
echo "8e575e8a44568392d5b6e089eab5da5cdbd45885  sed-4.1.5.tar.gz" | \
 sha1sum -c

# Verify tarball w/ gpg:
( gpg --recv-keys A750566F > /dev/null 2>&1 || gpg --list-keys A750566F ) &&
 wget -nc http://ftp.gnu.org/gnu/sed/sed-4.1.5.tar.gz.sig &&
  gpg --verify sed-4.1.5.tar.gz.sig && rm sed-4.1.5.tar.gz.sig

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "sed-*" -exec rm -r {} \;
tar xzvf ~/sed-4.1.5.tar.gz
cd sed-4.1.5
test $UID = 0 && chown -R root:root .

# If you don't have a sed binary installed (./configure uses it), do
# this first:
sh ./bootstrap.sh
su -c "cp sed/sed /bin/"
cd ..
rm -r ./sed-4.1.5
tar xzvf ~/sed-4.1.5.tar.gz
cd sed-4.1.5
test $UID = 0 && chown -R root:root .

./configure --prefix=/usr --bindir=/bin --disable-nls
make

# Become root to install it
su

find /usr/doc -maxdepth 1 -type d -name "sed-*" -exec rm -r {} \;
rm -f /usr/info/sed.info* /usr/man/man1/sed.1*
find /usr/share/locale -type f -name "sed.mo" -exec rm {} \; 2> /dev/null
find /var/adm/packages -type f -name "sed*" \
 -exec mv -f {} /var/log/removed_packages/ \;
find /var/adm/scripts -type f -name "sed*" \
 -exec mv -f {} /var/log/removed_scripts/ \;
make install-strip

# Everything prior to Slackware 9.0, and this howto as well, put sed in
# /usr/bin.  Slackware 9.0 puts sed in /bin and creates a symlink to it
# in /usr/bin.  Makes sense, sed is important and if your /usr is actually
# a mount of a remote filesystem, sed might not exist early on during boot-up.
# So here we remove the old binary and create a symlink to the new one:
rm -f /usr/bin/sed
ln -sf /bin/sed /usr/bin/sed

# Slackware >= 9.0 has a 'sed' package, everything prior to it included sed in
# the 'bin' package.  If you have < 9.0 and are really anal (like me),
# remove lines from the /var/adm/packages/bin* file that reference sed
# files that you just replaced:
# /usr/bin/sed
# /usr/doc/sed-*
# /usr/man/man1/sed.1.gz
# /usr/info/sed.info.gz

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/sed-*.tar.*
mv sed-4.1.5.tar.gz installed/

Back to the list


Last updated: Fri, 26 Mar 2010 13:18:56 -0400
Jason Englander <jason at englanders dot us>