Path: utzoo!utgpu!watmath!iuvax!cica!tut.cis.ohio-state.edu!ra.umb.edu!mam From: mam@ra.umb.edu (Margaret Ann Metcalf) Newsgroups: gnu.utils.bug Subject: problems with sed Message-ID: <8910280012.AA06569@ra.umb.edu> Date: 28 Oct 89 00:12:43 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 63 This is to report a bug found with gnu sed versions 1.02 and 1.06. Problem lies in asking sed to perform branches (b label). Error message is /usr/local/gnu/bin/sed: Can't find label for jump to '' Machines are Sun3 runing SunOS 3.4, Sun SPARCStation running SunOS 4.0.3, Sun 386i running SunOS 4.0.1. Only version 1.06 was tried on SPARC and Sun386i. Here are details on script used for test. Script used for test is known to work with /bin/sed (Sun's sed). It was modified only to specify use of GNU sed. Script expects input lines in format of /etc/passwd with hostname prepended. I.E., ra|root:lWlgn9USZ1TPI:0:1:System Administrator:/:/bin/csh Expected output is of form Administrator, System root 0 ra / Here's script #!/bin/sh /usr/local/gnu/bin/sed \ -e ':jr' \ -e '/ Jr[^:]*:/ {' \ -e '/:\([^: ]*\) \([^: ]*\) Jr[\.]*:/s//:\2, \1 Jr.:/' \ -e '/:\([^: ]* [^: ]*\) \([^: ]*\) Jr[\.]*:/s//:\2, \1 Jr.:/' \ -e 'b all' \ -e '}' \ -e ':3d2p' \ -e '/[^:]*:[^:]*:[^:]*:[^:]*:[^ ]* [^ ]* [IV]*:/ {' \ -e '/:\([^: ]*\) \([^: ]*\) \([IV\.]*\):/s//:\2, \1 \3:/' \ -e 'b all' \ -e '}' \ -e '/^\([^:]*:[^:]*:[^:]*:[^:]*:\)\([^: ]* [^: ]*\) \([^: ]*\) \([IV\.]*\):/{' \ -e 's//\1\3, \2 \4:/' \ -e 'b all' \ -e '}' \ -e ':3pn' \ -e '/^\([^:]*:[^:]*:[^:]*:[^:]*:\)\([^: ]* [^: ]*\) \([^: ]*\):/ {' \ -e 's//\1\3, \2:/' \ -e 'b all' \ -e '}' \ -e ':2pn' \ -e '/^\([^:]*:[^:]*:[^:]*:[^:]*:\)\([^: ]*\) \([^: ]*\):/ {' \ -e 's//\1\3, \2:/' \ -e 'b all' \ -e '}' \ -e ':all' \ -e '/^\([^:| ]*\)[| ]*\([^:]*\):[^:]*:\([^:]*\):[^:]*:\([^:]*\):\([^:]*\).*/ {' \ -e 's//\4 \2 \3 \1 \5/' \ -e 'b' \ -e '}' \ # -e 's/^\([^:]*\):[^:]*:/\1::/' \ # 1=machine 2=login 3=uid 4=name 5=home # juniors - handle various forms then kick out # thirds - handle various forms then kick out # 3 part names # 2 part names # all lines - strip out password field thanks, mam@umb.umb.edu