home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / utils / bug / 2264 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.0 KB  |  78 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sojurn.lns.pa.US!mike
  3. From: mike@sojurn.lns.pa.US (Mike Sangrey)
  4. Subject: sed (my suggested fix is broke)
  5. Message-ID: <m0n3obE-0003RBM@sojurn.lns.pa.us>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Mon, 21 Dec 1992 04:59:14 GMT
  10. Approved: bug-gnu-utils@prep.ai.mit.edu
  11. Lines: 65
  12.  
  13. This message refers to the patch that dealt with what I think is a bug with
  14.    sed -n s/foo/bar/p
  15.  
  16. Specifically, in sed.c the change was
  17.  
  18.       if (cur_cmd->x.cmd_regex.flags & S_WRITE_BIT
  19.           && !no_default_output)
  20.         ck_fwrite (line.text, 1, line.length,
  21.                cur_cmd->x.cmd_regex.wio_file);
  22.       if (cur_cmd->x.cmd_regex.flags & S_PRINT_BIT
  23. -          && !no_default_output)
  24.         ck_fwrite (line.text, 1, line.length, stdout);
  25.       break;
  26.  
  27. ---- to ----
  28.  
  29.       if (cur_cmd->x.cmd_regex.flags & S_WRITE_BIT
  30.           && !no_default_output)
  31.         ck_fwrite (line.text, 1, line.length,
  32.                cur_cmd->x.cmd_regex.wio_file);
  33.       if (cur_cmd->x.cmd_regex.flags & S_PRINT_BIT
  34. +          || !no_default_output)
  35.         ck_fwrite (line.text, 1, line.length, stdout);
  36.       break;
  37.  
  38.  
  39. A few days ago I made this suggestion.  However, my simple fix causes
  40. something else to break.  
  41.  
  42. For example:
  43.  
  44. ----------------------
  45. #!/bin/sh
  46.  
  47. az=abcdefghijklmnopqrstuvwxyz
  48. AZ=ABCDEFGHIJKLMNOPQRSTUVWXYZ
  49.  
  50. /bin/sed -e "
  51.     y/$AZ/$az/
  52.     h
  53.     y/$az/$AZ/
  54.     G
  55.         s/\(.\).*\n./\1/
  56. "
  57. ----------------------
  58.  
  59. echo fooHaaHAA | this-script         # gives Foohaahaa with*out* my patch
  60.  
  61. And that is as it should be, at least with my understanding.  With my
  62. patch, it gives two lines:
  63.  
  64. Foohaahaa
  65. Foohaahaa
  66.  
  67. Hope this helps. 
  68. Hope that any previous help that I helped with didn't unhelp.
  69.  
  70. Thanks again.
  71.  
  72. mike@sojurn.lns.pa.us
  73. -- 
  74.   |  UUCP-stuff:  ...!pitt!devon!sojurn!mike | "Disk space ...               |
  75.   |  Internet  :  mike@sojurn.lns.pa.us      |      the final frontier."     |
  76.   |  Fast-stuff:  (717) 396-9897             |                               |
  77.  
  78.