bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30829: bug: empty regex exits with error when following 2-address li


From: Don Crissti
Subject: bug#30829: bug: empty regex exits with error when following 2-address like LINENO, /RE/
Date: Thu, 15 Mar 2018 21:20:37 +0100

   The manual states that

   "the empty regular expression ‘//’ repeats the last regular expression
   match"

   however this does not work when the empty regex follows a 2-address of
   the form LINE_NUMBER,/REGEX/
   e.g.

   # printf %s\\n {1..5} | sed '2,/5/{//!d}'

   fails with

   "sed: -e expression #1, char 0: no previous regular expression"

   instead of printing

   1
   5

   If it matters, a 2-address like /REGEX/,LINE_NUMBER works as expected
   e.g.:

   # printf %s\\n {1..5} | sed '/2/,5{//!d}'

   correctly prints

   1
   2

   This is with gnu sed 4.4 on archlinux, vanilla.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]